Question

I'm using UIDocumentInteractionController to open a file in another app, DropBox.

What i'm trying to do is open the file in another specific app , but i only managed so far to display the supported apps and allowing the user to choose.

UIDocumentInteractionController *udi = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath: jpgPath]];
[udi retain];
CGRect r = CGRectMake(0, 0, 300, 300);
[udi presentOpenInMenuFromRect:r inView:self.view animated:YES];

This presents a list of apps supported, but i want to directly open the file with dropbox, without the options box. Any ideas?

Was it helpful?

Solution

I'd be delighted to be contradicted, but I think this is not possible (at least up to and including iOS 4).

The normal way to open a file in another application is to use a Custom URL scheme. (See the documentation for openURL: in the UIApplication Class Reference and also Implementing Custom URL Schemes in the iOS Application Programming Guide.) To the best of my knowledge, Dropbox have not implemented a Custom URL Scheme. And, given that, this approach is closed.

UIDocumentationController is pretty opaque. You can coax it into telling you whether or not there is any application on the device that will open your file. But it's not clear you can do much else.

OTHER TIPS

If you want to offer open file in a specific app, just add (using swift 3.0):

docController.uti = @"com.dropbox.ios";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top