UIDocumentPickerViewController 导入 SSL 证书

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 文件总是被禁用 select 它:

此外,我找不到导入不带扩展名的文件的方法。

这就是我让它工作的方式。首先,我必须导入移动核心服务:

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