Core data model configuration & Leopard
Core data model configuration & Leopard
- Subject: Core data model configuration & Leopard
- From: email@hidden
- Date: Sun, 28 Oct 2007 17:45:26 -0700
I have a relatively simple core data non-document application that
runs fine under OS 10.4. However, when I run the same app on OS
10.5, it cannot open the data file. I get the error "The model
configuration used to open the store is incompatible with the one
that was used to create the store." I traced the first time this was
called to the code below, the call to addPersistentStoreWithType.
The method "managedObjectContext" has not changed since I created the
project with Xcode. Does anyone have any suggestions as what I can
do to get my app to read the store in OS 10.5?
Thanks,
Kyle
- (NSManagedObjectContext *) managedObjectContext {
NSError *error;
NSString *applicationSupportFolder = nil;
NSURL *url;
NSFileManager *fileManager;
NSPersistentStoreCoordinator *coordinator;
if (managedObjectContext) {
return managedObjectContext;
}
fileManager = [NSFileManager defaultManager];
applicationSupportFolder = [self applicationSupportFolder];
if ( ![fileManager fileExistsAtPath:applicationSupportFolder
isDirectory:NULL] ) {
[fileManager createDirectoryAtPath:applicationSupportFolder
attributes:nil];
}
url = [NSURL fileURLWithPath: [applicationSupportFolder
stringByAppendingPathComponent: @"MyData.sqlite"]];
coordinator = [[NSPersistentStoreCoordinator alloc]
initWithManagedObjectModel: [self managedObjectModel]];
-> if ([coordinator addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil URL:url options:nil error:&error]){
managedObjectContext = [[NSManagedObjectContext alloc] init];
[managedObjectContext setPersistentStoreCoordinator: coordinator];
} else {
[[NSApplication sharedApplication] presentError:error];
}
[coordinator release];
return managedObjectContext;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden