Database Reference
In-Depth Information
onto the receiving persistent store. Through this process, each persistent
store is kept in sync with the other. In addition, new persistent stores can be
added to the mix by simply starting with an empty store and playing back
the transactions one at a time until the new store is brought up-to-date.
If the application has seen a lot of activity, there can be a large number of
transaction logs. The large number of transaction logs means any new device
must take a significant amount of time to “catch up” with the current state
of the persistent store. For this reason, Core Data cuts a new “baseline” on
a regular interval. A baseline is effectively a “roll-up” of the transaction logs
to a certain point. Any logs after the baseline point will pile up as before. A
new store coming into the sync starts with a baseline instead of an empty
database and consumes any transaction logs generated after the baseline.
This strategy keeps the amount of time it takes to bring a new persistent store
up to speed to a minimum.
Turning Off iCloud
Currently, there is an outstanding issue when the user turns off iCloud. When
this event occurs, our application receives no notification. The data simply
goes away. Some developers have been successful in adding a “sentinel” file
to the ubiquitous container (via the URL that gets resolved when we configure
iCloud) and monitoring that file. If the file goes away, then we can decide how
to handle the state change. Creating a sentinel file has not been approved (or
disallowed) by Apple, and this solution may not work in future versions of
Core Data.
Ordered Relationships Are Not Allowed
If we integrate iCloud into our application, we cannot use the new ordered
relationships that were added as of iOS 6.0 and OS X 10.8. iCloud integration
does not work with ordered relationships. Ideally, this deficiency will be cor-
rected at some point.
Data Migration
An additional limiting factor with iCloud integration is the use of lightweight
migration. Heavy-weight migration (as in a migration that requires a mapping
model) cannot be used if iCloud is enabled. With an iCloud-enabled NSPersis-
tentStore , the mapping model will simply be ignored, and the migration fails.
Therefore, particular care must be taken when you are doing a migration to
not cross the limit of lightweight/inferred migration. If a migration requires
more complexity than a lightweight migration can handle, then it is recom-
mended that a new ubiquitous container be set up, the migration be done
 
 
Search WWH ::




Custom Search