UIDocumentPickerViewController导入SSL证书

问题描述 投票:0回答:1

如何使用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文件始终禁用以选择它:

cer disabled

此外,我找不到一种方法来导入没有扩展名的文件。

ios swift uidocumentpickervc
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显然是由一个bug:http://www.openradar.me/24187873

© www.soinside.com 2019 - 2024. All rights reserved.