9
I've got a NSPersistentDocument-based Core Data app that targets 10.5 Leopard and above. I'm about to release an update that makes changes to the data model, and therefore need to migrate existing documents to the new model. The changes are relatively straightforward, and I've created a mapping model for them. Note that I'm not trying to do automatic lightweight migration, I do have a mapping model (lightweight migration isn't supported on Leopard, but my model changes rule it out anyway). In my NSPersistentDocument subclass, I override -configurePersistentStoreCoordinatorForURL... as follows:
- (BOOL)configurePersistentStoreCoordinatorForURL:(NSURL *)url
ofType:(NSString *)fileType
modelConfiguration:(NSString *)configuration
storeOptions:(NSDictionary *)storeOptions
error:(NSError **)error
{
NSMutableDictionary *newOptions = (storeOptions ?
[NSMutableDictionary dictionaryWithDictionary:storeOptions] :
[NSMutableDictionary dictionary]);
[newOptions setObject:(id)kCFBooleanTrue forKey:NSMigratePersistentStoresAutomaticallyOption];
return [super configurePersistentStoreCoordinatorForURL:url
ofType:fileType
modelConfiguration:configuration
storeOptions:newOptions
error:error];
}
This works fine on 10.6 and 10.7. However, on 10.5, the call to [super configurePersistentStore...] throws an exception and fails. The error is:
Error Domain=NSCocoaErrorDomain Code=134020 UserInfo=0x15812d70 "The model configuration used to open the store is incomp