1

我试图通过单击按钮打开文档选择器视图控制器,但其中没有显示任何选项。如您在屏幕截图中所见,仅显示更多选项。我想显示 iCloud、谷歌驱动器、保管箱等选项。我只想从云存储中获取任何文档、图像或 pdf 文件,并想在我的应用程序中显示它。我试过这段代码,

 @available(iOS 8.0, *)
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {


    let cico = url as URL
    print("The Url is : \(cico)")


    //optional, case PDF -> render
    //displayPDFweb.loadRequest(NSURLRequest(url: cico) as URLRequest)




}

@available(iOS 8.0, *)
public func documentMenu(_ documentMenu:     UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {

    documentPicker.delegate = self
    present(documentPicker, animated: true, completion: nil)

}



func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {

    print("we cancelled")

    dismiss(animated: true, completion: nil)


}
@IBAction func docsBtnTapped(_ sender: Any) {

    let importMenu = UIDocumentMenuViewController(documentTypes: [String(kUTTypePDF)], in: .import)
    importMenu.delegate = self
    importMenu.modalPresentationStyle = .formSheet
    self.present(importMenu, animated: true, completion: nil)
}

在选择器控制器中只有这个, 在此处输入图像描述

但我想在这个控制器中显示选项,当点击它应该带我们到那个云存储。我还从我的应用程序的功能中启用了 iCloud 选项。

4

0 回答 0