application(…continue userActivity…) method not called in ios 13

前端 未结 2 584
情歌与酒
情歌与酒 2020-12-09 16:24

Hi I\'m making ios app using UniversalLink.

Universal Link works fine, but callback method is not called.

My AppDelegate.swift is below.



        
2条回答
  •  暖寄归人
    2020-12-09 16:55

    In my case, I started a brand new project on Xcode 11 which uses SceneDelegate as well as AppDelegate

    Looks like UniversalLinks (and probably several other APIs) use this callback on the SceneDelegate:

    func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { }
    

    Instead of this callback on the AppDelegate:

    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { }
    

    Once I implemented the one on SceneDelegate everything started working as expected again. I haven't tried it, but I'm assuming that if you are targeting iOS 12 and below, you might need to implement both methods.

    Hope this helps

提交回复
热议问题