I'm working on a Xamarin.Forms project that can be called from another application using an url "testscheme://dosomething".
A OnePage
should be shown if the application is called directly and AnotherPage
if called through an url.
I have it working on UWP but I fail on iOS... I think I miss something but can't figure what. On iOS, only OnePage
is shown but never AnotherPage
.
Here is what I have now (just the essential):
iOS AppDelegate
:
public partial class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Xamarin.Forms.Forms.Init();
LoadApplication(new App(null)); // url is sent to the XF App - null because direct call
return base.FinishedLaunching(app, options);
}
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
Xamarin.Forms.Forms.Init();
LoadApplication(new App(url)); // url is sent to the XF App
return true;
}
}
PCL App
:
public class App : Application
{
public App(Uri url = null)
{
if (url == null)
{
MainPage = new NavigationPage(new OnePage());
}
else
{
MainPage = new NavigationPage(new AnotherPage());
}
}
}
Debugger and some Debug.WriteLine
in OnePage
and AnotherPage
constructors told me that AnotherPage
constructor is called if url
is not null and OnePage
is updated. But iOS just keeps showing the default OnePage
...
XF version: 2.1.0.6529
iOS 7.2 mini (tests on iPad iOS 9.2)
Any help is welcome, I was not able to find any example code on the internet nor discussions.