continueUserActivity not called

人盡茶涼 提交于 2020-01-23 06:07:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!