Re: Strange Managed Context Error
Re: Strange Managed Context Error
- Subject: Re: Strange Managed Context Error
- From: mmalcolm crawford <email@hidden>
- Date: Sat, 20 Aug 2005 20:02:50 -0700
On Aug 20, 2005, at 7:37 PM, Colin Cornaby wrote:
If you're using a subclass of NSManagedObjectContext then no, it's
not done automatically. How have you configured it?
How have you configured the context in the NSPersistentDocument? Put
another way, how does the persistent document know to use you
NSManagedObjectContext subclass and...
The following is the first part of my init method (the relevent part):
-(id)init{
self = [super init];
//Set up our store co-ordinator using our schema
NSPersistentStoreCoordinator *coordinator
= [[NSPersistentStoreCoordinator alloc]
initWithManagedObjectModel:
[[NSManagedObjectModel mergedModelFromBundles:[NSArray
arrayWithObjects:[NSBundle bundleForClass:[self class]], nil]]
retain]];
[Aside: This will generate a memory leak.
NSManagedObjectModel *model = [NSManagedObjectModel
mergedModelFromBundles:
[NSArray arrayWithObject:[NSBundle bundleForClass:[self class]]]];
NSPersistentStoreCoordinator *coordinator =
[[NSPersistentStoreCoordinator alloc]
initWithManagedObjectModel: model];
]
//Set this context to use our new store co-ordinator
[self setPersistentStoreCoordinator: coordinator];
The odd NSBundle code is because this code and the schema is within
a framework.
... given this init method, how have you set the coordinator for the
document?
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden