UIManagedDocument + iCloud “Big Picture”?

天涯浪子 提交于 2019-12-04 10:25:59

Generally I can recommend to read the iCloud Design Guide - in particular the section "Designing for Documents in iCloud".

As for your questions:

  • What does "stored in the cloud" really mean?

    If your are using UIManagedDocument following the Stanford videos, your App will upload change logs when data is added/edited/deleted. However your device has kind of a "iCloud Cache" where it stores the iCloud data and access it from (you have access to that folder when you are offline or even when your app is deleted and reinstalled). If you NSLog the URLs of the documents in your iCloud folder (you should do this with NSMetadataQuery you get the path of the iCloud files locally on your device, which is

    /private/var/mobile/Library/Mobile Documents/<Developer identifier>/<App identifier>/...

    For this reason, you'll need to think about a bunch of things when accessing your UI(Managed)Documents on iCloud on the first time app launch or on each app launch (e.g. is iCloud available, do you have network connection, ...).

    However, following the way of the videos you'll not have separate documents in your app sandbox and in iCloud (you could achieve this of course when saving your document for creation to the iCloud URL as well as to a local URL in the app sandbox).

  • The need of merging changes

    As described above, your devices are saving change logs which include the adds/edits/deletes to your document. These change logs are uploaded to iCloud and downloaded by the other devices connected to the same iCloud account. Each device can rebuild the current state of your data model with the change logs. This makes iCloud extremly efficient (a complete upload on each time would take much longer). Concerning the sync process of these changes I can also refer to the iCloud Design Guide. In short, you'll have to think about your device syncing the local iCloud folder each time when it comes back to online mode.

For anyone still struggling try this site.

http://ossh.com.au/design-and-technology/software-development/

There are sample apps for iOS and OSX that include iCloud integration, backups, iCloud sync status, etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!