我终于设法建立了通用链接,如果我点击该链接,它将打开我的应用程序。但不会在继续用户活动或源应用程序中显示。因为我想将其重定向到特定的视图控制器。我打开“ https:// www.myWeb.com/forgotPassword”的示例
它将重定向到forgotPasswordViewController,我需要阅读链接。
为什么它在继续的用户活动中不显示
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
print(url)
let urlHost : String = url.host as String!
print("HELLO")
let main : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let inner : ResetPasswordViewController = main.instantiateViewController(withIdentifier: "ResetPasswordViewController") as! ResetPasswordViewController
self.window?.rootViewController = inner
self.window?.makeKeyAndVisible()
return true;
}
func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {
if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
let url = userActivity.webpageURL!
print(url)
print("HELLO WORLD")
} …Run Code Online (Sandbox Code Playgroud)