I am using the UIDocumentationInteractionController to show the sharing options for a PDF document. (See image below) Everything is working as expected except for the Add Tags option
Tapping on it immediately dismisses the controller modal view instead of showing another popup for selecting the tags.
I also see this error on the console when I perform the above workflow.
DocInteractionTest[7132:5381612] Warning: Attempt to present <_UIRemoteViewController: 0x118003a00> on <UIActivityContentViewController: 0x116000000> whose view is not in the window hierarchy!
I believe that this happens as the modal view gets dismissed before the Add Tags modal is getting added on the view hierarchy stack. However, I am unable to understand why is this happening? Has anyone else also seen this similar issue in the past?
It would also be fine for me to hide that option (Add Tags) but I doubt that is possible since Apple doesn't expose any APIs to do this.
Here is some sample code that I have to launch the document interaction controller modal view (I have only included the relevant parts)
@interface ViewController () < UIDocumentInteractionControllerDelegate>
@property (nonatomic, strong) UIDocumentInteractionController *shareDocumentInteractionController;
@end
@implementation ViewController
- (void) showShareMenu:(id) sender {
NSURL* url = [NSURL fileURLWithPath:[self getPDFPath]]; // pdf document path on disk
self.shareDocumentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
self.shareDocumentInteractionController.delegate = self;
self.shareDocumentInteractionController.UTI = @"com.adobe.pdf";
[self.shareDocumentInteractionController presentOpenInMenuFromBarButtonItem:sender animated:YES];
}
@end

