Can we import any file to our application from icloud? - ios

I know users can upload documents to icloud from their applications. I want to access these documents from my application. Is it possible to access any documents in icloud from our application?

According to the official doc: "To locate documents in iCloud storage, your app must search using an NSMetadataQuery object". But I suspect you can't simply access the documents of other apps freely.

Related

iCloud drive - is it possible to access user files

I configured my IOS project to work with iCloud drive. Now I'm able to store and read files from my app's ubiquitous container.
Is it however possible to access also files from root directory of iCloud?
Let's assume the user put some movie file into his iCloud Drive folder on Mac. The movie file can be now seen and downloaded using iCloud Drive application on Iphone. Can I also access this file from my application?
Or, to put it in other way, can I query for and access files uploaded by user to his iCloud root folder?
Edit:
From my investigation it looks that the only way to access these files is using UIDocumentPickerViewController. I didn't find any solution to access the files programatically so that I can filter them and display to user using custom UI.

Export & Import Documents using iCloud in IOS

I am developing an app that makes user to export core data records into an document using iCloud Drive/iCloud Documents/iCloud Kit and he can able to import and access those document at another device.
I mean Export/Import of documents within devices that are using same application. Documents can be identified by unique document name for importing..
Please Give any suggestions for above task. Which one is more useful..or suggest any other useful links for above task.
1) iCloud Documents. (Documents Storage)
2) iCloud Kit.(Huge/complex amount of data)
3) Key-Value Storage.(Small amount of data)
I have successfully implemented export/import using iCloud Documents. But I am able to access the documents which are exported in same device only. As it stores with local storage..
I used iCloudSync for retrieving the documents.
https://github.com/iRareMedia/iCloudDocumentSync
Now, I am referring iCloud Kit for accessing within same app & multiple devices..
Thanks..!
I have successfully accessed the iCloud Files with same iCloud Account within multiple devices using below code
NSArray *tempArray=[[iCloud sharedCloud] listCloudFiles];
Source: https://github.com/iRareMedia/iCloudDocumentSync
It will retrieve all the iCloud files of same logged in iCloud Account that are exported from various devices..

Making iCloud documents local after iCloud is disabled by the user

As noted by the Document-Based App Programming Guide, "When the user changes the preference, the application should move all document files in the application sandbox to iCloud or move all files in the other direction, depending on the nature of the change.”
But NSMetaDataQuery does not run when iCloud is disabled, so how can I get the URLs of the user's iCloud documents so I can transfer each to the local directory?
This was under the assumption the docs meant in the iCloud Drive switch. Instead they mean an option in the app's preferences that you add yourself.

Can my app let users save some files to iCloud and rest on device

In Apple's Document Based App Development Guide, it emphasizes that our app should let users choose either to save all their files to iCloud or save all on local device. Is there reason for this? Can we actually allow users to pick some files to be saved on iCloud and some to be saved locally, like the TextEdit app on mac OS X? Will App Store disapprove iOS apps configured in this way if it is programmatically possible?
Thanks!
Here is a link
https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/DocumentBasedAppPGiOS/ManageDocumentLifeCycle/ManageDocumentLifeCycle.html#//apple_ref/doc/uid/TP40011149-CH4-SW1
Setting the Preferred Storage Location for Document Files
All documents of an application are stored either in the local sandbox or in an iCloud container directory. A user should not be able to select individual documents for storage in iCloud.
When an application launches for the first time on a device, it should do the following:
If iCloud is not configured, ask users if they want to configure it (and, preferably, transfer them to Launch Settings if they want to configure iCloud).
If iCloud is configured but not enabled for the application, ask users if they want to enable iCloud—in other words, ask if they want all of their documents saved to iCloud. Store the response as a user preference.
Based on this preference, an application writes document files either to the local application sandbox or the iCloud container directory. (For details, see “Moving Documents to and from iCloud Storage.”) An application should expose a switch in the Settings application that enables users to move documents between local storage and iCloud storage.
If it makes sense for your app, there is no reason Apple would care if you save some files locally and some in iCloud. It's not a hard fast rule to be all one way or the other.

iCloud data sharing to all app users

I wanted to know if icloud could be used as a file sharing database for your application amongst all app users or not. If for example in my app you can save a file on icloud, can anyone who uses my app download it or only the person who has uploaded it??
Using iCloud there are no sharing options - only the user who uploaded data can access it.

Resources