My application required to post an image to Instagram, I used UIDocumentInteractionController to open image file saved in the Documents directory with an extension .igo. Set com.instagram.exclusivegram as the UIDocumentInteractionController's UTI property. That all worked fine, my problem is that when I use
[dic presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
to open the UIDocumentInteractionController, it shows PDF reader, DropBox etc. I have to hide the other options than Instagram or show Instagram only. And also how to identify the Cancel button press in the presented menu.
Why is my UIDocumentInteractionController showing other options?
If you're using some code snippet from the Internet, make sure you implemented the delegate method correctly.
-(UIDocumentInteractionController *)setupControllerWithURL:(NSURL *)fileURL
usingDelegate:(id<UIDocumentInteractionControllerDelegate>) interactionDelegate
{
// if you're creating a new instance here,
// make sure you set the properties correctly
UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
// remember to set it again here
interactionController.UTI = @"com.instagram.exclusivegram";
interactionController.delegate = interactionDelegate;
return interactionController;
}
How can I know if a user cancel the action or proceed to Instagram?
Please refer to the answer of this thread: UIDocumentInteractionController Open Menu Cancelled Callback.
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