![](/img/trans.png)
[英]Using UIDocumentPickerViewController to import text in Swift
[英]UIDocumentPickerViewController import SSL Certificate
如何使用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
文件始终禁用选择它:
另外,我找不到没有扩展名的文件导入方法。
这就是我的工作方式。 首先,我必须导入移动核心服务:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.