Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't UIDocumentPickerViewController choose PDFs?

Tags:

ios

I am using UIDocumentPickerViewController in Import mode and it shows PDFs on iCloud and Dropbox. However they are all greyed out and I cannot select them. What am I doing wrong?

like image 423
Cocoanetics Avatar asked Jan 18 '17 16:01

Cocoanetics


Video Answer


2 Answers

First

import MobileCoreServices

now you're eable to access new values such as

String(kUTTypePDF)

Finally, in your Document View Controller

let importMenu = UIDocumentMenuViewController(documentTypes: [String(kUTTypePDF)], in: .import)

enjoy

like image 162
Abu Alfadl Avatar answered Oct 07 '22 10:10

Abu Alfadl


You need to provide the types of documents that the user is allowed to select.

let docTypes = [
        "com.adobe.pdf"
    ]

let docViewCtlr = UIDocumentMenuViewController(documentTypes: docTypes, in: .import)
like image 5
Prerak Sola Avatar answered Oct 07 '22 11:10

Prerak Sola