【发布时间】:2018-08-09 14:03:16
【问题描述】:
所以我在我的应用中实现了通用链接,当按下按钮时,我打开我的第二个应用:
UIApplication.shared.open(aUrl!)
我也接到了电话:
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restoreHandler: @escaping ([Any]?) -> Void) -> Bool {}
这是一个警报。
问题就像标题所说的那样..我如何导航到特定的 VC (从 FirstApp 到我用通用链接打开的 SecondApp),更像是映射 navigation controller stack 。
我写过类似的东西:
if let controller = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MyAdsController") as? MyAdsViewController {
if let window = self.window, let rootViewController = window.rootViewController {
var currentController = rootViewController
while let presentedController = currentController.presentedViewController {
currentController = presentedController
}
currentController.present(controller, animated: true, completion: nil)
}
}
但这是一个丑陋的表示,我需要像洞导航堆栈这样的东西......
另外,如果我想通过通用链接处理更多内容,我可以为此创建一个辅助类吗?任何建议表示赞赏。
【问题讨论】:
-
您的意思是,您希望导航到从第一个应用程序打开的第二个应用程序中的特定视图控制器?
-
是的,完全正确。我已经编辑了我的问题
-
您是否有理由不使用 UINavigationController 并重置您想要的堆栈(
navigationController.viewControllers = [vc1, vc2, controllerYouWant])? -
不,一点也不,问题是我不知道怎么做 :)
标签: ios swift swift3 uinavigationcontroller ios-universal-links