gpt4 book ai didi

c# - xamarin 表单应用程序链接 - 从 ios 应用程序委托(delegate)打开 PCL View

转载 作者:行者123 更新时间:2023-11-29 11:36:52 25 4
gpt4 key购买 nike

在 Xamarin Forms 跨平台应用中,我可以从外部电子邮件应用链接打开应用。

它在 android 中打开很好,通过向 list 添加一个意图,然后在启动的事件中,我创建另一个意图来触发主要事件

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 触发了 app delegate 中 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 中的 View

最佳答案

对于任何感兴趣的人,我通过替换对其进行了排序

LoadApplication(new App(true, code));

App.Current.MainPage = enterPin();

调用

public Page enterPin()
{
return new EnterPinPage(SimpleIoc.Default.GetInstance<ISecureStorage>(), code, 1);
}

关于c# - xamarin 表单应用程序链接 - 从 ios 应用程序委托(delegate)打开 PCL View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48686670/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com