如何从我的iOS应用程序中访问iCloud Drive中的文件? [英] How to access files in iCloud Drive from within my iOS app?

查看:1128
本文介绍了如何从我的iOS应用程序中访问iCloud Drive中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从iCloud Drive中选择文件,类似于 UIImagePickerController()

Is there a way to choose file from iCloud Drive similar way to UIImagePickerController()?

推荐答案

您需要启用 iCloud 权利。执行此操作后,您可以通过以下方式显示控制器:

You need to enable iCloud entitlements. Once you do this, you are able to present controller the following way:

let documentPickerController = UIDocumentPickerViewController(documentTypes: [String(kUTTypePDF), String(kUTTypeImage), String(kUTTypeMovie), String(kUTTypeVideo), String(kUTTypePlainText), String(kUTTypeMP3)], inMode: .Import)
documentPickerController.delegate = self
presentViewController(documentPickerController, animated: true, completion: nil)

在你的委托中实现方法:

In your delegate implement the method:

func documentPicker(controller: UIDocumentPickerViewController, didPickDocumentAtURL url: NSURL)

这篇关于如何从我的iOS应用程序中访问iCloud Drive中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆