Re: Getting managedObject Context
Re: Getting managedObject Context
- Subject: Re: Getting managedObject Context
- From: Gideon King <email@hidden>
- Date: Sun, 30 Aug 2009 09:34:58 +1000
If you use NSPersistentDocument instead of NSDocument, it has all that
already built in for you.
Gideon
On 30/08/2009, at 8:59 AM, Clayton Leitch wrote:
I have spent the last month try to solve a simple problem. I need
to get the managedObjectContext in a NSDocument based application.
I know how to get this in a non-document based application
-(NSManagedObjectContect *)managedObjectContext {
if (!managedObjectContext) {
managedObjectContext = [[NSApp delegate] managedObjectContext];
}
return managedObjectContext;
}
From the documentation it appears that I get the managedObject
Context from the MyDocument instead of the application delegate. I
tried a similar structure to the above replacing NSApp delegate with
MyDocument. Does anyone have an example of getting the
manageObjectContext from the MyDocument class?
_______________________________________________
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