Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

continueUserActivity not called

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.

like image 369
Ivan Avatar asked Feb 06 '18 10:02

Ivan


1 Answers

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!

like image 162
Franlon Avatar answered Oct 09 '22 16:10

Franlon