I would like to know how to present the “Open In…” Action Sheet (iPhone) / Popover (iPad) from my app, preferably an IBAction
I would hope that it’d be similar to declaring a file type then creating the view and opening the app selected by the user, but I know it is more complicated then that.
I realize that a similar question has been asked on StackOverflow, but I cannot make sense of the answer that was accepted: How to use “open in…” feature to iOS app?, and I have found some Apple Documentation on Document Interaction Programming. But, I can’t really make sense of these.
Create a
UIDocumentInteractionControllerby using theinteractionControllerWithURL:class method (pass the URL of the file you want to open in another app).Then call either
presentOpenInMenuFromRect:inView:animated:orpresentOpenInMenuFromBarButtonItem:animated:. The controller takes care of presenting the popover with available apps for that file type and opening the selected app.If you want to know when the menu was dismissed and which app was selected, you need to implement the
UIDocumentInteractionControllerDelegateprotocol.