I am currently developing an application specifically for iOS7 that utilizes UIDocumentInteractionController open in menu and need a method that notifies me when a user cancels and does not choose an available option.
UIDocumentInteractionControllerDelegate offers:
- (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *) controller
but this does not specify whether the user tapped one of the available options or cancel.
Any ideas?
NOTE: This will not work for iOS 8 anymore, only iOS7 and earlier
To determine whether the user has canceled the menu or selected an option, you have to make use of the following delegate methods:
1-
- (void)documentInteractionController:(UIDocumentInteractionController *)controller
           didEndSendingToApplication:(NSString *)application
{
    //get called only when the user selected an option and then the delegate method bellow get called
    // Set flag here _isOptionSelected = YES;
    _isOptionSelected = YES;
}
2- 
- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller
{
    //called whether the user has selected option or not
    // check your flag here 
    if(_isOptionSelected == NO) {
        //the user has canceled the menu
     }
    _isOptionSelected = NO;
}
iOS 8
For iOS 8 and above, use this method instead of the one in step 2:
- (void)documentInteractionController:(UIDocumentInteractionController *)controller
           didEndSendingToApplication:(NSString *)application
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With