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


- (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];



- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {

    NSString *url = userActivity.userInfo[@"url"];



source to share

1 answer

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: // apple_ref / occ / instm / WKInterfaceController / updateUserActivity: userInfo: webpageURL :

You just need to call updateUserActivity

and add the dictionary userInfo

to this call.



All Articles