我想从 Google 驱动器和 One Drive 云服务中选择文件用于我正在使用的目的UIDocumentPickerViewController
前任:
func didPressOneDriveChoose() {
let importMenu = UIDocumentPickerViewController(documentTypes: [(kUTTypePDF as String), (kUTTypeJPEG as String), (kUTTypePNG as String)], in: .import)
importMenu.delegate = self
importMenu.modalPresentationStyle = .formSheet
self.show(importMenu, sender: nil)
}
在委托方法上收到回调:
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]){
var arrFiles = [Dictionary<String, AnyObject>]()
for url in urls {
// returns local document directory URL
// needs original GoogleDrive or OneDrive URL
}
}
但我想知道有什么方法可以让用户选择哪个云服务,并且我想要指向该 URL 的原始 URL?目前,它在单击下载该文件后返回本地文档目录 URL。