From the app lifecycle of xamrin forms :
- iOS –
Main method > AppDelegate > App > ContentPage
.
- Android –
MainActivity > App > ContentPage
We will see that Main method
invoke App
class before , if need a instance of App from iOS , generally will try as follow :
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App(app)); // pass app to Forms
return base.FinishedLaunching(app, options);
}
However ,Forms can not using UIKit
(error screenshot).

In xamarin forms , there is DependencyService to load navtive method . Therefore, suggest that using DependecyService to call app
from iOS native AppDelegate.cs
.
About using SceneDelegate.cs
in Xamarin Forms , there is no SceneDelegate.cs
file in iOS solution now . I will check that whether be possible in Xamarin Forms .
==================================Update==============================
If want to deal with a universal link in AppDelegate.cs
, you need to do something in continueUserActivity
method as follow :
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler)
{
//return base.ContinueUserActivity(application, userActivity, completionHandler);
if(userActivity.ActivityType == NSUserActivityType.BrowsingWeb)
{
NSUrl url = userActivity.WebPageUrl;
// other code
}
return true;
}
==================================Update===============================
Finally , found that it is possible to add SceneDelegate
to a Xamarin Forms project. A new Xamarin Forms project does not come with the necessary SceneDelegate.cs
or .storyboard files, so these need to be added. After adding these files, the info.plist needs to be updated with the UIApplicationSceneManifest
key, which will contain more needed keys.
The additions to info.plist
are shown here: https://learn.microsoft.com/en-us/xamarin/ios/platform/ios13/multi-window-ipad#project-configuration (just UIApplicationSceneManifest and everything under)
The two things to note are that:
- The sample has issues with navigation working properly when having multiple windows of the app running.
- This is not an official sample, as Xamarin.Forms does not currently offer official support for using mutiple Scenes with an iOS application.
The unofficial Xamarin.Forms sample is here:https://www.dropbox.com/s/sdxq5me7vcdmuf9/XamFormsiOSMultiWindow.rar?dl=0