C# xamarin表单应用程序链接-从ios应用程序代理打开PCL视图
在Xamarin表单跨平台应用程序中,我可以从外部电子邮件应用程序链接打开该应用程序 它在android中打开得很好,通过向清单添加一个意图,然后在启动的活动中,我创建另一个意图来启动主活动C# xamarin表单应用程序链接-从ios应用程序代理打开PCL视图,c#,ios,xamarin.forms,applinks,C#,Ios,Xamarin.forms,Applinks,在Xamarin表单跨平台应用程序中,我可以从外部电子邮件应用程序链接打开该应用程序 它在android中打开得很好,通过向清单添加一个意图,然后在启动的活动中,我创建另一个意图来启动主活动 public class AppLinkActivity : Activity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); string code = n
public class AppLinkActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
string code = null;
if (Intent.Data.Query != null)
{
code = Intent.Data.Query.Substring(Intent.Data.Query.LastIndexOf('=') + 1);
}
if (Intent.Data != null)
{
var uri = Intent.Data;
if (uri != null)
{
Intent i = new Intent(this, typeof(MainActivity));
i.AddFlags(ActivityFlags.ReorderToFront);
i.PutExtra("code", code);
i.PutExtra("flag", true);
this.StartActivity(i);
}
}
this.FinishActivity(0);
}
}
在ios中,applink会触发应用程序委托中OpenUrl的覆盖,但我不确定如何从这里导航到特定的PCL页面,实际情况是应用程序在最后打开的页面打开
public override bool OpenUrl(UIApplication app, NSUrl url, string sourceApp, NSObject annotation)
{
string _uri = url.ToString();
string code = _uri.Substring(_uri.LastIndexOf('=') + 1);
LoadApplication(new App(true, code));
return true;
}
谁能用这个给我指出正确的方向吗?我真正需要做的就是,从OpenUrl方法,导航到PCL中的一个视图对于任何感兴趣的人,我通过替换
LoadApplication(new App(true, code));
与
哪个叫
public Page enterPin()
{
return new EnterPinPage(SimpleIoc.Default.GetInstance<ISecureStorage>(), code, 1);
}
公共页面enterPin()
{
返回新的EnterPinPage(SimpleIoc.Default.GetInstance(),代码,1);
}
首先谢谢你,只是我坚持不打电话给基地作为回报。OpenUrl(app,url,options);只要回归真实;
public Page enterPin()
{
return new EnterPinPage(SimpleIoc.Default.GetInstance<ISecureStorage>(), code, 1);
}