• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem using custom entity class with subclasses NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem using custom entity class with subclasses NSArrayController


  • Subject: Re: Problem using custom entity class with subclasses NSArrayController
  • From: David Groulx <email@hidden>
  • Date: Thu, 18 May 2006 14:45:28 -0600

On May 18, 2006, at 2:37 PM, mmalcolm crawford wrote:


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?


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.

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"?

Yes.
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
  • Follow-Ups:
    • Re: Problem using custom entity class with subclasses NSArrayController
      • From: mmalcolm crawford <email@hidden>
References: 
 >Problem using custom entity class with subclasses NSArrayController (From: David Groulx <email@hidden>)
 >Re: Problem using custom entity class with subclasses NSArrayController (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Binding to Accessors of Application Delegate
  • Next by Date: Problem using NSPopUpButtonCell in NSTableView
  • Previous by thread: Re: Problem using custom entity class with subclasses NSArrayController
  • Next by thread: Re: Problem using custom entity class with subclasses NSArrayController
  • Index(es):
    • Date
    • Thread