iCloud Integration for uploading and downloading files

前端 未结 1 1197
野的像风
野的像风 2021-02-04 15:18

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

相关标签:
1条回答
  • 2021-02-04 15:55

    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".

    0 讨论(0)
提交回复
热议问题