Reputation: 2555
My app needs to open some file types in other apps, like dropbox app does, it could list the installed apps which could open specific types of file.
How can get the app list?
Upvotes: 19
Views: 17272
Reputation: 1995
Expanding on jtbandes's answer, here's the code that worked for me:
NSURL *url = [NSURL fileURLWithPath:filePath];
UIDocumentInteractionController *popup = [UIDocumentInteractionController interactionControllerWithURL:url];
[popup setDelegate:self];
[popup presentPreviewAnimated:YES];
And don't forget to include this in your H file:
@interface MyViewController : UIViewController <UIDocumentInteractionControllerDelegate>
Also worth noting: this will open a new fullscreen view that has a Document Viewer, as well as the Share button that offers all the various apps that can open this file. If you're just looking for the Share popup, equivalent to the UIActivityViewController, this will do it, but with some extra functionality you may not want.
Upvotes: 1
Reputation: 118651
You'll want to use UIDocumentInteractionController. See also the Document Interaction Programming Guide.
Upvotes: 30