Re: Core data model configuration & Leopard
Re: Core data model configuration & Leopard
- Subject: Re: Core data model configuration & Leopard
- From: Bill <email@hidden>
- Date: Mon, 29 Oct 2007 08:42:02 -0700
On Oct 28, 2007, at 11:12 PM, Chris Hanson wrote:
On Oct 28, 2007, at 5:45 PM, email@hidden wrote:
coordinator = [[NSPersistentStoreCoordinator alloc]
initWithManagedObjectModel: [self managedObjectModel]];
What's the implementation of -managedObjectModel look like? Is it
creating a merged model from all frameworks you're using, or is it
just loading a specific model from your application bundle?
It should really do the latter, so you don't wind up with
extraneous entities in the schema for your SQLite persistent
store. Otherwise you could wind up with a persistent store that
you can't open after changing the configuration of your system or
on another system.
-- Chris
It seems to be creating a merged model from all frameworks I'm using
(see below). And the app does use a lot of frameworks besides the
standard set. There's Security, SystemConfiguration, and Message.
I'm not sure how to load a specific model from my app bundle, but I
will definitely look into it and see if that helps.
Thanks,
Bill
- (NSManagedObjectModel *)managedObjectModel {
if (managedObjectModel) return managedObjectModel;
NSMutableSet *allBundles = [[NSMutableSet alloc] init];
[allBundles addObject: [NSBundle mainBundle]];
[allBundles addObjectsFromArray: [NSBundle allFrameworks]];
managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:
[allBundles allObjects]] retain];
[allBundles release];
return managedObjectModel;
}
_______________________________________________
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