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:37:57 -0700
On May 18, 2006, at 1:27 PM, David Groulx wrote:
I subclassed NSArrayController to override its -(IBAction)add:
method. Within that method I create a new entity with the code:
NSManagedObjectContext* moc =
[[NSApp delegate] managedObjectContext];
NSManagedObjectModel* mom =
[[moc persistentStoreCoordinator] managedObjectModel];
NSEntityDescription* entity =
[[mom entitiesByName] objectForKey:@"Uda"];
NSManagedObject* newUda =
[[NSManagedObject alloc] initWithEntity:entity
insertIntoManagedObjectContext:moc];
[self addObject:newUda];
and that worked fine.
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?
Now I need to use a custom class for this entity, but I get the
error
Attempt to create an NSManagedObject that does NOT correspond to
the proper Class from the NSEntityDescription.
Is the entity name for the controller "Uda"?
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