ios - Universal links, continueUserActivity and sourceApplication not being called -


i manage universal links, if tap link open app. doesn't show in continue user activity or source application. because want redirect specific view controller. example if open "https:// www.myweb.com/forgotpassword"

it redirect forgotpasswordviewcontroller, need read link.

why doesn't show in continue user activity

func application(_ application: uiapplication, open url: url, sourceapplication: string?, annotation: any) -> bool {     print(url)     let urlhost : string = url.host 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")     }     return true } 

and happened source application, can tell me why becomes that?

sourceapplication

solved it's because of type data, put anyobject instead of any. compiler doesn't tell me if anyobject can't used

func application(_ application: uiapplication, continue useractivity: nsuseractivity, restorationhandler: @escaping ([any]?) -> void) -> bool {     print("continue user activity: ")     if useractivity.activitytype == nsuseractivitytypebrowsingweb {         let url = useractivity.webpageurl!         print(url.absolutestring)         //handle url     }     return true } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -