Reputation: 2317
I'm trying to get my head around the setCompletionWithItemsHandler: part of the UIActivityViewController in iOS8.
Eventually, I want to perform an action, if either the operation is cancelled by the user, or can not be completed for any other reason.
In order to see what's going on, I put some logging in my code, like this:
-(void)shareThis {
UIActivityViewController *controller = [[UIActivityViewController alloc]
initWithActivityItems:@[text, url, image]
applicationActivities:nil];
[controller setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
NSLog(@"completed: %@, \n%d, \n%@, \n%@,", activityType, completed, returnedItems, activityError);
}];
[self presentViewController:controller animated:YES completion:nil];
}
Somehow, I don't get any logs at all, suggesting that I'm doing something wrong. Is it the order? While I'm typing this, I realise that I only tested in the Simulator.
Upvotes: 3
Views: 1478
Reputation: 2317
OK, this was my mistake. For logistical reasons (and I'm still trying to figure out how to solve that) I had to duplicate this method in several classes. I had put the logging in the one class, but called the other class.
This is so stupid. I tried to destroy this question, because, while people can learn from this stupidity, the chance they will ever run into this specific question for the same reason is close to zero.
Once again, thank you for your patience..
Upvotes: 1