Database Reference
In-Depth Information
CHAPTER 6
Using iCloud
Starting with iOS 5.0 and Mac OS X 10.7 Lion, Apple has added the ability
to sync a Core Data application to iCloud. For developers, that means we can
easily add cloud sharing of our application's data without the need to build
our own servers. It also means our applications can share data between
devices and computers.
Unfortunately, as has been demonstrated numerous times in the past, syncing
is hard, very hard. Apple did not get it working acceptably in iOS 5.0 or OS
X 10.7. It was not until iOS 6.0 and OS X 10.8 that iCloud has become truly
reliable. While the functionality discussed in this chapter was technically
introduced in 5.0/10.7, we will be discussing it under 6.0/10.8. It is not
recommended to try to implement these features prior to 6.0/10.8.
iCloud integration allows developers to sync data between any number of
computers and devices; we can sync between an iPhone application, an iPad
application, a Mac application, or any combination thereof. In fact, we can
add the ability to sync with our very first application, and new clients added
later will automatically sync once we make them available to our users.
There are two approaches to adding iCloud integration to an application on
iOS. We have the option of just adding a few options to our NSPersistentStore , or
we can use the new API called UIManagedDocument .
If we have an existing application, the choice is simple: adding the options to
the NSPersistentStore has the smallest impact on our code base. However, in
order to properly move everything into iCloud, we do need to do some addi-
tional work, as outlined in Section 6.5, Migrating an Existing Application , on
page 113 .
For a new application, it is worth looking at UIManagedDocument and deciding
whether it makes sense for the particular type of application you are designing.
 
 
 
Search WWH ::




Custom Search