Ios Handoff missing NSUserActivity in launchOptions?

I implemented Handoff in our application, and it works great for streaming on the Internet and vice versa when the application is running in the foreground or in the background.

However, if the application is not running, then if the user starts the application from the network to transfer application maintenance, in the launchOptions dictionary I get UIApplicationLaunchOptionsUserActivityDictionaryKey , but there is no link to the activity.

See screenshot:

enter image description here

As you can see, I only get the ID for NSUserActivity . Is this a bug in iOS 9?

Is there any way to get activity link using id?

Edit, here is the code, although I do not think it is relevant

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if (launchOptions && [[launchOptions allKeys] containsObject:UIApplicationLaunchOptionsUserActivityDictionaryKey]) { __block NSUserActivity *activity; NSDictionary *userActivityDictionary = [launchOptions objectForKey:UIApplicationLaunchOptionsUserActivityDictionaryKey]; if (userActivityDictionary) { [userActivityDictionary enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { if ([obj isKindOfClass:[NSUserActivity class]]) { activity = obj; } }]; } //app was started by URL (deep linking), check parameters if (activity) { NSURL *url = activity.webpageURL; //resume from URL } } return YES; } 
+6
source share
1 answer

Good,

I passed TSI about this to Apple, and it seems that this is not a mistake, but a design.

You can resume your activity in the application:continueUserActivity:restorationHandler , which in my case was not called.

Well, my mistake was that you need to return YES in the application:didFinishLaunchingWithOptions: method, otherwise, if you return NO, application:continueUserActivity:restorationHandler not called.

We have implemented FB in our application, so we return a [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions] , which will return NO.

I changed our code in the application:didFinishLaunchingWithOptions: function to this

 if (launchOptions && [[launchOptions allKeys] containsObject:UIApplicationLaunchOptionsUserActivityDictionaryKey]) { return YES; } else { return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; } 

Therefore, the delegate application:continueUserActivity:restorationHandler successfully delegated, and the action can be resumed successfully.

+5
source

All Articles