问题
I have an app that supports Universal Links. Everything looks properly set up. I have an apple-app-site-association
file on the server, appropriate link added to Associated Domains and also I added application:continueUserActivity:restorationHandler
to the AppDelegate.
Finally, I added a link to my Notes app and when I click the link and hold it I'm able to see button Open in "MyApp". When I tap the button iOS opens the app but application:continueUserActivity:restorationHandler
is never called. What makes this even more mysterious is that application:willContinueUserActivityWithType:
gets called (of course I return YES here)
UPDATE: If my app is not running in the background mode and I click the link I get my app opened and I get NSUserActivity
object in launchOptions
parameter of the application:didFinishLaunchingWithOptions:
. But still application:willContinueUserActivityWithType:
isn't called.
回答1:
I know this is an old question, but I faced this issue myself. Did you migrate to a newer version of Swift? In my case, the function stopped working after the migration. The function was renamed from
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool
to
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
.
Hope this helps!
来源:https://stackoverflow.com/questions/48640208/continueuseractivity-not-called