No results from setCompletionWithItemsHandler

I am trying to get my head around setCompletionWithItemsHandler: part of UIActivityViewController in iOS8.

Ultimately, I want to take an action if the operation is canceled by the user or cannot be performed for some other reason.

To see what is going on, I entered some codes into my code, for example:

-(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 am not getting any logs at all, assuming I am doing something wrong. Is this an order? As I type this, I realize that I have only tested in the simulator.

+3


source to share


1 answer


Ok, that was my fault. For logistic reasons (and I'm still trying to figure out how to solve this) I had to duplicate this method across multiple classes. I put the log in one class, but called another class.

This is so stupid. I tried to destroy this question because while people can learn from this nonsense, the likelihood that they will ever face this particular question for the same reason is close to zero.



Thank you again for your patience.

+1


source







All Articles