gpt4 book ai didi

c# - 推送通知 : Navigate to a ViewController from the AppDelegate

转载 作者:行者123 更新时间:2023-11-29 02:06:12 26 4
gpt4 key购买 nike

目前,我正在努力通过添加推送通知来完善我目前正在开发的 iOS 应用程序。这些推送通知会发送给人们,以通知他们应用程序内有一项要执行的操作。

我目前正致力于实现“当您在应用程序中并收到通知”部分:ReceivedRemoteNotification

现在,由于此方法需要在 AppDelegate 内部实现,所以我无法只说 NavigationController.PushViewController (viewController, true);。创建新的 NavigationController 无效。

所以,现在我想知道:有没有办法获取已初始化的 NavigationController(因为我已经打开了应用程序),以便我可以使用 PushViewController 方法?

或者有其他方法可以从 AppDelegate 导航到 ViewController 吗?

最佳答案

在 Xamarin/C# 中,您应用的 Root View Controller 是:

UIViewControler rootViewController = this.window.RootViewController;

从您在 AppDelegate 中覆盖 FinishedLaunching 看起来应该很熟悉。从那里您应该能够导航 View 层次结构以使您的用户到达正确的位置。

关于c# - 推送通知 : Navigate to a ViewController from the AppDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29770495/

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