如何使用UIDocumentPickerViewController导入SSL证书
我正在做这样的事情:
let documentPicker: UIDocumentPickerViewController = UIDocumentPickerViewController(documentTypes: ["public.item"], in: UIDocumentPickerMode.import)
documentPicker.delegate = self
documentPicker.modalPresentationStyle = .formSheet
if #available(iOS 11.0, *) {
documentPicker.allowsMultipleSelection = false
}
UINavigationBar.appearance().tintColor = .green
self.present(documentPicker, animated: true, completion: completion)但.cer文件始终处于禁用状态,无法选择它:

另外,我找不到一种不带扩展名的导入文件的方法。
发布于 2017-12-18 23:46:34
这就是我让它工作的方式。首先,我必须导入移动核心服务:
import MobileCoreServices然后,这就是我实例化UIDocumentPickerViewController的方式
let types: NSArray = NSArray(object: kUTTypeX509Certificate as NSString)
let documentPicker: UIDocumentPickerViewController = UIDocumentPickerViewController(documentTypes: types as! [String], in: UIDocumentPickerMode.import)顺便说一句,我只让它与iCloud Drive一起工作,而不能与Google Drive一起工作,显然是因为一个错误:http://www.openradar.me/24187873
https://stackoverflow.com/questions/47841458
复制相似问题