Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iCloud Integration for uploading and downloading files

Tags:

ios

icloud

I want to design an app which stores documents on iCloud. But there are some question which has answer before doing actual implementation.

The question are as follows,

  1. What is maximum file size to upload on iCloud?
  2. Can I programmatically calculate/know the available space on user's iCloud account?
  3. How can I get the event for uploading and Downloading files from iCloud?

Can anyone please help me here ? I read the apple documentation but not understood all the things completely.

Thanks In Advance.

like image 899
Vijay Avatar asked Jan 30 '14 12:01

Vijay


1 Answers

Although you mentioned you've read the apple icloud documentation, the designing for icloud documentation page from Apple is still a good starting point for this question.

File Size Limits

The documentation doesn't specify a Document file size limit, nor a Core Data storage limit, other than a user account icloud storage allowance. There is a limit for Key Value storage which is 1Mb for a value (in a value-key pair), which could be an issue for you, but otherwise it seems you can store large files as long as the user has enough space available.

Given the 5gb default amount and accounting for the default user storage needs (photos, contacts, calendars and the like), you may encounter limits for Document and Core Data storage, like any other app. The file management for icloud page mentions good app behaviour:

Apps that take advantage of iCloud storage features should act responsibly when storing data in there. The space available in each user’s account is limited and is shared by all apps. In addition, users can see how much space is consumed by a given app and choose to delete documents and data associated with your app. For these reasons, it is in your app’s interest to be responsible about what files you store.

Check Available Space Programmatically

No

Upload/Download Events

The file uploading and downloading is handled by the OS. All files are stored locally, it's from this local store that you request/modify/save documents. From the icloud fundamentals page:

When you adopt iCloud, the operating system initiates and manages uploading and downloading of data for the devices attached to an iCloud account. Your app does not directly communicate with iCloud servers and, in most cases, does not invoke upload or download of data.

See this app coda tutorial for an example of key-value store integration, this Tim Roadley tutorial for Core Data store integration or this Ray Wenderlich tutorial for Document store integration.

Edit: The Document-Based App Programming Guide for iOS provides code snippets for moving files to/from iCloud, uploading and downloading as well as monitoring file changes. See "Downloading Document Files from iCloud" and "Moving a Document to iCloud Storage".

like image 79
Jason McDermott Avatar answered Sep 28 '22 10:09

Jason McDermott