Reputation: 10859
I have a very simple model that is created when the app is launched for the very first time and populated with the contents of a plist. I will need to re-create the model again when an update to the app is downloaded and launched. I know that you can version coredata models but I don't foresee the model itself is going to change. I will just need to go through the existing array of objects and add new objects from the plist. For this I need to check the version number of the app and somehow detect it is different from the model on the device.
Upvotes: 1
Views: 773
Reputation: 64428
If you want the app version, just check the Bundle version
key in the info.plist file.
Upvotes: 0
Reputation: 16337
Take a look at this method on NSPersistentStore
+ (BOOL)setMetadata:(NSDictionary *)metadata forPersistentStoreWithURL:(NSURL *)url error:(NSError **)error
You can set an arbitrary dictionary of key/value pairs. Make one to represent your version. Then you can load back that dictionary with:
+ (NSDictionary *)metadataForPersistentStoreWithURL:(NSURL *)url error:(NSError **)error
Upvotes: 3