iCloud(一)综述

来源:互联网 发布:python正则表达式 编辑:程序博客网 时间:2024/04/28 16:59

什么是iCloud?

iCloud is a free service that lets users access their personal content on all their devices—wirelessly and automatically via Apple ID. iCloud does this by combining network-based storage with dedicated APIs, supported by full integration with the operating system. Apple provides server infrastructure, backup, and user accounts, so you can focus on building great iCloud-enabled apps.

image: ../Art/iCloud_intro_2x.png

The core idea behind iCloud is to eliminate explicit synchronization between devices. A user never needs to think about syncing and your app never interacts directly with iCloud servers. When you adopt iCloud storage APIs as described in this document, changes appear automatically on all the devices attached to an iCloud account. Your users get safe, consistent, and transparent access to their personal content everywhere.

iCloud关注的是“content”,而不是整个application,因为在restore from iCloud的时候,iphone会自动下载你当时备份的版本,如果你备份的版本不存在了,则会下载最新版本。
在你自己设计程序时,你可以将你想要backup的数据添加到iCloud中。

iCloud能backup什么?
Three data types that can stored in iCloud:
1. key-value pairs
 iCloud has an extremely easy to use helper class called NSUbiquitousKeyValueStore that is very similar to NSUserDefaults. If your app has a small amount of data to store (< 1 MB), this method is usually the best choice.

2. Document
The final method is to create a document based app by subclassing a class called UIDocument. If your app is based around the concept of individual documents that the user can create/read/update/delete that you want listed as separate files in Settings, this method is usually the best choice.

3. Core Data
You can set up Core Data to store its data on iCloud. If your app doesn’t have the concept of documents or files but has a large amount of data, this method is usually the best choice.

如何backup到iCloud?

Go to the iCloud settings and choose Storage and Backup. Make sure iCloud backup is set to “On.”

According to Apple, this is what’s backed up: Purchased music, TV shows, apps, and books; photos and video in the Camera Roll; device settings; app data; home screen and app organization; messages (iMessage, SMS, and MMS); and ringtones. Apple’s mantra is anything that can be re-downloaded isn’t backed up, so your apps and any apps that have downloadable content aren’t stored in the cloud. If you have large amounts of app data, like PDFs in GoodReader, you may find yourself going over your free 5 GB limit. Naturally, if you do want all that data backed up, you can buy more storage: 15 GB is $20 per year; 25 GB is $40 per year; and 55 GB is $100 per year.

To specify which app data is or is not backed up, while still in the Storage and Backup section of the iCloud settings, click on Manage Storage and then your iOS device. Here, you can specify which apps iCloud backs up, and which it doesn’t.

iCloud backups happen whenever the device is plugged in, on a Wi-Fi network, and locked (meaning it’s at the Swipe to Unlock screen). If you want to check when the last backup was, or force a backup, at the bottom of the Storage and Backups screen there is a Back Up Now button.

如何Restoring from backup?

Right now, backups and restores are done on the assumption you’ve either replaced your device, or your whole install is so messed up you had to nuke from orbit. The only way you can restore data is from the setup screen on a fresh install of iOS; you can’t just restore the specific data from a single app you accidentally deleted. This will be less of a problem once apps are updated to store their own backups in iCloud.

To reset your device, under General, choose Reset, and then Erase All Content and Settings. Your device will be restored to factory conditions and you will be prompted with this screen.

Restoration is a two-step process: first the device settings are restored, then all apps are re-downloaded from Apple’s servers. The restoration happens in order: the first app on your first screen is the first app to be re-downloaded. If you want to prioritize an app, tap on its icon. According to Apple, the restore will attempt to download the same version of the app that you had installed previously. If that version is no longer available, the latest version of the app will be restored instead.

Refs:

http://gigaom.com/2011/10/18/ios-101-set-up-and-restore-from-icloud-backup/


原创粉丝点击