Ok after tests, it seems that you need to declare the NSUserActivity
as a instance Variable :
So this does not work:
@interface TestViewController () {
}
@end
@implementation TestViewController
- (void)viewDidLoad {
[super viewDidLoad];
//init hand off
NSUserActivity *activity = [[NSUserActivity alloc] initWithActivityType:@"com.app.browse"];
activity.webpageURL = [NSURL URLWithString:@"http://www.stackoverflow.com"];
[activity becomeCurrent];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
But this works fine:
@interface TestViewController () {
NSUserActivity *activity;
}
@end
@implementation TestViewController
- (void)viewDidLoad {
[super viewDidLoad];
//init hand off
activity = [[NSUserActivity alloc] initWithActivityType:@"com.app.browse"];
activity.webpageURL = [NSURL URLWithString:@"http://www.stackoverflow.com"];
[activity becomeCurrent];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Not sure why though, I'm looking into it now