I am using an instance of UIDocumentInteractionController
to offer the user the option to open a given document, if a capable app is installed on their device.
Apple's documentation for the QuickLook Framework mentions that:
To display a Quick Look preview controller you can use any of these options:
- Push it into view using a UINavigationController object.
- Present it modally, full screen, using the presentModalViewController:animated: method of its parent class, UIViewController.
- Present a document interaction controller (as described in Previewing and Opening Files. The user can then invoke a Quick Look preview controller by choosing Quick Look from the document interaction controller’s options menu.
(emphasis mine)
I am opting for that third option: Instead of using a QLPreviewController
, I am presenting an UIDocumentInteractionController
; this is my code:
@IBAction func openDocument(sender: AnyObject) {
let interactionController = UIDocumentInteractionController(URL: documentURL)
interactionController.delegate = self
// First, attempt to show the "Open with... (app)" menu. Will fail and
// do nothing if no app is present that can open the specified document
// type.
let result = interactionController.presentOpenInMenuFromRect(
self.view.frame,
inView: self.view,
animated: true
)
if result == false {
// Fall back to options view:
interactionController.presentOptionsMenuFromRect(
self.view.frame,
inView: self.view,
animated: true)
}
}
The fallback path gets executed (options menu), because I don't have any app that can open docx. However, the mentioned "Quick Look" option is not present:
What am I missing?
NOTE: I am not implementing any of the methods of UIDocumentInteractionControllerDelegate
.