大佬教程收集整理的这篇文章主要介绍了ios – 当app不在后台时打开通用链接,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在didFinishLaunchingWithOptions中添加了一些代码.但它不起作用.非常感谢你如果有人可以提供帮助.
func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let activityDic = launchOptions?[UIApplicationLaunchOptionsKey.userActivityDictionary] if activityDic != nil { // ConTinue activity here self.window?.rootViewController?.restoreUserActivityState(activityDic as! NSUserActivity) } return true } func application(_ application: UIApplication,conTinue userActivity: NSUserActivity,restorationHandler: @escaping ([Any]?) -> Void) -> Bool { if userActivity.activityType == NSUserActivityTypeBrowsingWeb { if let controller = UIStoryboard(name: "Main",bundle: nil).instantiateViewController(withIdentifier: "xxx") as? XXXTableViewController { 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) } } } return true }
if let url = launchOptions?[UIApplicationLaunchOptionsKey.url] as? URL { //Deeplink // process url here } else if let activityDictionary = launchOptions?[UIApplicationLaunchOptionsKey.userActivityDictionary] as? [AnyHashable: Any] { //Universal link for key in activityDictionary.keys { if let userActivity = activityDictionarY[key] as? NSUserActivity { if let url = userActivity.webpageURL { // process url here } } } }
以上是大佬教程为你收集整理的ios – 当app不在后台时打开通用链接全部内容,希望文章能够帮你解决ios – 当app不在后台时打开通用链接所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。