I'm using Xcode 6.3.2 to develop an application for iOS 8.3 which needs to pull CSV files from a user's iCloud account. These spreadsheets will be generated by a separate system and saved into the user's iCloud Drive folder (there will be multiple spreadsheets, in the app the user will type in a key string which determines which spreadsheet should be accessed), the method for doing so will be handled my client and unless it can't be done a special way, isn't relevant. The application itself needs to take a key string and search the user's iCloud drive for that file, if it exists get the contents of the file and if possible, save it locally so it can be accessed even if the iCloud Drive is unavailable.
The current application works with local CSV files within the application bundle (ones I've copied into my Xcode project), so now I need to integrate the iCloud functionality.
Solved: I've read various tutorials which show you how to upload and download to/from the iCloud Drive, although I'm still a bit confused as to how it works. Which leads me to question one.
- Does my application only have access to files that are saved to iCloud by the application itself. Or, for example, if I add the CSV files to the iCloud Drive via Finder on my iMac, can I then access those files from within my application, if so how would I go about this?
I'm currently assuming the latter of question one is correct, however I'm now worried I've misunderstood how it works (hence question one). I've setup the application to use iCloud - it successfully grabs the ubiquity URL but when querying for any CSV files it returns nothing. I'm currently using the simulator and have read that it should work, although other sources suggest it wont, on the simulator I've logged in with the appropriate Apple ID and enabled iCloud Drive - however the files I placed in my iCloud Drive folder on my iMac aren't visible. Onto question 2...
- Does iCloud Document Storage work on the iOS Simulator, if so is there anything special I need to do to initiate a sync to grab the CSV files I placed in my iMac's iCloud Drive folder.
EDIT: I've done some further digging and managed to get iCloud working on an actual device - which I guess answers question 2: iCloud Document Storage doesn't work properly on the iOS Simulator. I've also seen tutorials or screenshots showing that my assumptions of question 1 were correct.
Now I'm at the point when I can see my app has documents stored in iCloud when going to Settings > iCloud > Storage > Manage Storage on my iPad, and when I go to System Preferences > iCloud > Manage. I can see that data exists, however I cannot see my app folder when I navigate to Finder > iCloud Drive. What I need to do is drop files into my app folder in iCloud Drive on my Mac, so that they can be read in via my application. I read that simply appending the 'Documents' folder to the end of my ubiquity URL would make it visible in finder, however this hasn't worked. This leads me onto question 3:
- What do I need to do to make my applications specific iCloud folder visible in the iCloud Drive folder within my Mac's Finder window?