0

如何使用导入 SSL 证书UIDocumentPickerViewController

我正在做这样的事情:

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文件始终无法选择它:

cer 已禁用

另外,我找不到导入没有扩展名的文件的方法。

4

1 回答 1

0

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

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

于 2017-12-18T15:46:33.910 回答