I want to send a URL from my app to open on a laptop web browser using handoff. I have added the activity type to my app's NSUserActivityTypes
. here is my code so far:
- (void)startHandoff {
NSUserActivity *activity = [[NSUserActivity alloc] initWithActivityType:@"com.me.browse"];
activity.webpageURL = [NSURL URLWithString:_wakeUrl];
[activity becomeCurrent];
}
It doesn't seem to be appearing on my dock - does it need a special Activity Type
if you want to use safari?
Ok after tests, it seems that you need to declare the
NSUserActivity
as a instance Variable :So this does not work:
But this works fine:
Not sure why though, I'm looking into it now