User info is empty from Handoff using NSUserActivity
I am trying to send a string from my WatchKit app: I can start the app using the lock screen ok, but when a method is called continueUserActivity
with userActivity.userInfo
no values, am I missing something here?
- The only value I get is activityType
Clock:
- (void)createActivity {
self.activity = [[NSUserActivity alloc] initWithActivityType:@"com.myApp.urlSend"];
[self.activity setUserInfo:@{@"url":self.wake.href}];
[self.activity setTitle:self.wake.title];
[self.activity becomeCurrent];
}
Telephone:
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
NSString *url = userActivity.userInfo[@"url"];
}
source to share
I just noticed that you create your own activity. If you check the docs, you'll see that Handoff works differently on Watch when compared to other platforms: https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceController_class/index.html# // apple_ref / occ / instm / WKInterfaceController / updateUserActivity: userInfo: webpageURL :
You just need to call updateUserActivity
and add the dictionary userInfo
to this call.
source to share