Is it possible to fetch/display iCloud drive and iCloud Photos contents using CloudKit.

I want to display user's iCloud drive cointents in my app, I could not find a way to fetch all user contents using CloudKit. I am new to CloudKit and iCloud, Need a direction here.

Replies

I haven't looked into CloudKit all that much, but I think you are looking for NSMetadataQuery...(if you have 'iCloud Documents' checked off in your App's Capabilities).


For Cloudkit, you get a CloudKit database (public/private), you can use to store any data you want in it, I guess you would have to build your app to store documents in the CloudKit database...but it doesn't sound like that is what you want?


If you are trying to show existing contents that is in iCloud Drive in your app, you need to use NSMetadataQuery on iOS. It is kind of tricky to work with. You also can use UIDocumentPickerViewController.

Thanks for your response.

Yes, my app is not intented to store documents in the CloudKit database. Actually I trying to build an app on tvos to show existing contents that is in iCloud Drive. I tried using UIDocumentPickerViewController but it seems unavailable on tvos. I am getting following error.

---->UIDocumentPickerViewController is unavailable : Not available on tvos


Any other suggestions?

>show existing contents that is in iCloud Drive

Your app can only access the content on CloudKit that your app placed there.