The documentation says that UIDocumentInteractionController allows to open file implicitly (UTI property is nil) with installed apps but not native.
UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
[controller retain];
controller.delegate = self;
//controller.UTI = uti;
CDVViewController* cont = (CDVViewController*)[ super viewController ];
CGRect rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);
[controller presentOpenInMenuFromRect:rect inView:cont.view animated:YES];
Is it possible to open for example pdf file in Safari or image in gallery?
P.S. I am new in Objective C :)
It is not possible to say the device what application must open your file.
You can use UIApplication's OpenUrl method to phone for example, or to launch Safari with some url.. For example:
[[UIApplication sharedApplication] openURL:@"tel://%i", someNumber];
But if you want to open a specific file you must use UIDocumentInteractionController.
Also there is QLPreviewController API to preview documents. Here is tutorial how to use it and to see how it looks.
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