Context is important. Also future-proofing.

If your app was originally written against v1 CoreData (Tiger), you need to update the app to be wise enough to check the store's metadata and run away, run away from any store containing unexpected values (ie version hash information). v1 CoreData always assumes that it can open a store it was told to open until later evidence proves otherwise; later versions of CoreData realized that was perhaps an unwise decision, and added the current versioning and migration infrastructure. Due to binary compatibility issues, applications compiled on Tiger will continue to exhibit the old behavior. There's a general discussion of migration under 10.4 at http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdZ104Versioning.html#//apple_ref/doc/uid/TP40002989

Later versions of CoreData always check the store metadata for version hash information, which is affected by things that could change the schema (adding and removing entities and/or persistent properties, adding or removing validation rules, etc), but not by things that don't change the schema (adding or removing transient properties, adding or removing default values). For more details, see the Core Data Model Versioning and Data Migration Programming Guide, and for a concrete discussion of what affects version hashes, the section on versioning (http://developer.apple.com/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmVersioning.html#//apple_ref/doc/uid/TP40004714-SW1 ).

An application controlled technique would be to add an application specific piece of metadata (a version # perhaps) to your stores, and have your various application versions categorically refuse to open a store whose app version is >= the version it knows how to read. This can allow for a better user experience than the default NSPersistentStoreIncompatibleVersionHashError returned by addPersistentStore, which is a bit vague about which newer version of the application you need to buy to open a given file.

Cheers,
+Melissa






_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to