How to access files in iCloud Drive from within my iOS app?
You can present controller the following way:
import MobileCoreServices
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)
Note that you don't need to set up iCloud Entitlement to use UIDocumentPickerViewController
. Apple provides sample code that demonstrates how to use this controller here
Hide iCloud Documents
If you don't want to expose this data to the user what you need is to save it to the library directory. Please take some time and read File System Basics.
Use the Library subdirectories for any files you don’t want exposed to the user.
The contents of the Library directory (with the exception of the Caches subdirectory) are backed up by iTunes and iCloud.
Related Topics
Uploading Archive Error: "Missing iOS Distribution Signing Identity for ..."
Table Header View Height Is Wrong When Using Auto Layout, Ib, and Font Sizes
iPhone Sdk:How to Play Video Inside a View? Rather Than Fullscreen
Xcode Changes Unmodified Storyboard and Xib Files
Is iOS Carplay API Public? How to Integrate Carplay
How to Implement Two Inits with Same Content Without Code Duplication in Swift
Iphone:How to Detect the End of Slider Drag
Swift - How to Dismiss All of View Controllers to Go Back to Root
What #Defines Are Set Up by Xcode When Compiling for Iphone
Swift Stack and Heap Understanding
Enterprise App Deployment Doesn't Install on iOS 8.1.3
How to Set the Uinavigationbar with Gradient Color
Facebook Sdk: App Not Registered as a Url Scheme
How to Save Nsmutablearray in Nsuserdefaults