I'm trying to send a string from my WatchKit app:
I can launch the app via the lock screen fine, but when the continueUserActivity
method is called, userActivity.userInfo
contains no values, am I missing something here?
-The only value I get is the activityType
Watch:
- (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];
}
Phone:
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
NSString *url = userActivity.userInfo[@"url"];
}
I just noticed that you are creating the activity yourself. If you check the docs, you'll see that Handoff works a bit differently on the Watch 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 your userInfo
dictionary in that call.