Re: Core Data Problem

  • On Feb 8, 2006, at 7:51 PM, Sean Willson wrote:

    > I'm running into a problem I was wondering if people have seen or
    > could help
    > with. I have core data document based application that I am unable
    > to save.
    > When I try to save the document I get:
    >
    > --
    > Exception raised during posting of notification.  Ignored.  exception:
    > Cannot perform operation since entity with name '(null)' cannot be
    > found
    > --
    >
    > printed into the console. I have turned off all object creation in my
    > context. All that is remaining now is 2 nibs are loaded that have
    > NSArrayController and NSObjectControllers in them. I don't have
    > anything at
    > all in the app, but yet the error persists.
    >
    > Are there any easy ways to track this down? Seems like I should be
    > able to
    > enable some debug level or set a breakpoint in a dummy subclass to
    > find this
    > but it's alluding me. Any comments or suggestions would be greatly
    > appreciated.

    This error is emitted by an NSObjectController set in Entity mode as
    it attempts to access the NSEntityDescription in the
    NSManagedObjectModel associated with the object class name as
    specified in the inspector in IB.  (That's a mouthful:  in short, you
    have a controller in entity mode with a nil object class name.)

    Select each of your controllers in IB, and hit Command-1 to bring up
    the inspector.  In the "Object Class Name" field at the top, ensure
    you have a valid entity name.

    - matthew
  • oddly enough all of my NSObjectControllers are bound. i checked all of my
    nibs and all of them specify a class to be used. i also confirmed that my
    subclasses of NSObjectController properly call the setObjectClass method in
    the init method. any other ideas on how to track this down?

    i WAS able to get my document based application to save though thanks to
    this code:

    http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocum
    entTutorial/06_CustomisingErrors/chapter_7_section_3.html


    after putting that - (NSError *)willPresentError:(NSError *)inError; method
    in my code and saving i found the error in my MOM. for some reason one of my
    relationships was set to always have a min of 1 in the to-many relationship.
    after removing that limitation everything was great.

    i do still need to figure out why i'm getting these errors but at least i
    can save now. i appreciate your help so far. hope the above link is helpful
    to others. thanks to apple for the great examples.

    sean
    http://www.wideasleep.com/