Re: Problem using custom entity class with subclasses NSArrayController
Re: Problem using custom entity class with subclasses NSArrayController
- Subject: Re: Problem using custom entity class with subclasses NSArrayController
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 18 May 2006 13:53:48 -0700
On May 18, 2006, at 1:45 PM, David Groulx wrote:
It's not clear why you're doing this? What does this add to the
default implementation of add:?
And if you do need to customise the behaviour of add:, why not
just invoke newObject?
The whole body of the add function presents an NSOpenPanel to the
user to get a folder. Then between creating the new managed object
and calling addObject:, the function parses an xml file located in
the folder to pick out information that needs to be stored in the
entity, sets those values for various keys in the managed object,
then once that is all done it adds the object to the array controller.
Is there any reason you cannot simply invoke newObject and set the
variables?
NSManagedObjectContext* moc =
[[NSApp delegate] managedObjectContext];
NSManagedObjectModel* mom =
[[moc persistentStoreCoordinator] managedObjectModel];
Hard-coding the managed object context is typically wrong. You
should use the controller's own context (whatever it's bound to).
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