Default Migration

Sometimes, you need more control than what lightweight migration offers. Let’s say, for instance, you want to replace the Measurement entity with another entity called Amount. In addition, you want the abc attribute from the Measurement entity to end up as an xyz attribute in the Amount entity. Any existing abc data should also be migrated to the xyz attribute. To achieve these requirements, you’ll need to create a model mapping to manually specify what maps to where. When the persistent store option NSInferMappingModelAutomaticallyOption is set to YES, Core Data still checks to see if there are any model-mapping files it should use before trying to infer automatically. It is recommended that you disable this setting while ...

Get Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.