Why does UIDocumentMenuViewController not accept kUTTypeText?
I've seen in this tutorial as well as the Apple docs that this piece of code should work.
let d = UIDocumentMenuViewController(documentTypes: [kUTTypeText as NSString], inMode: .Import)
o.delegate = self
self.presentViewController(d, animated: true, completion: nil)
But I am getting compile time error
+3
source to share
1 answer
kUTTypeText
is defined in the MobileCoreServices framework, so you must add
import MobileCoreServices
Also, as Bartlomey correctly pointed out, the type id needs to be converted from CFString
to String
in Swift 2 / Xcode 7:
UIDocumentMenuViewController(documentTypes: [kUTTypeText as String], inMode: .Import)
+15
source to share