Core Data: rare exception

  • Hola tod@s!

    I am playing with a Core Data Document based app and found that,
    while running and trying to add: an object, the following error
    message appears in the console

    2007-10-08 16:13:57.799 CDD_Curare[1945] *** -[NSCFDictionary
    _isMaintainingInverse]: selector not recognized [self = 0x3367b0]
    2007-10-08 16:13:57.800 CDD_Curare[1945] *** NSRunLoop ignoring
    exception '*** -[NSCFDictionary _isMaintainingInverse]: selector not
    recognized [self = 0x3367b0]' that raised during posting of delayed
    perform with target 3b3150 and selector 'invokeWithTarget:'

    Does anybody recognises this?
    knows how to fix it?

    Dino

    p.d., relevant info:

    the (relevant part of the) model is as follows: there are 4 related
    tables, say A <-->> B <-->> C <<--> D, all relations are optional.
    while adding A and after B, there is no problem at all; the problem
    is while trying to add C.
    I am writing no code at all; all duty is done due to bindings and
    outlets to the array controllers.
  • On Oct 8, 2007, at 5:26 PM, Ricardo Strausz wrote:

    > I am playing with a Core Data Document based app and found that,
    > while running and trying to add: an object, the following error
    > message appears in the console
    >
    > 2007-10-08 16:13:57.799 CDD_Curare[1945] *** -[NSCFDictionary
    > _isMaintainingInverse]: selector not recognized [self = 0x3367b0]
    > 2007-10-08 16:13:57.800 CDD_Curare[1945] *** NSRunLoop ignoring
    > exception '*** -[NSCFDictionary _isMaintainingInverse]: selector
    > not recognized [self = 0x3367b0]' that raised during posting of
    > delayed perform with target 3b3150 and selector 'invokeWithTarget:'
    >
    > Does anybody recognises this?

    This is really a FAQ.

    Whenever you see SomeClass: selector not recognized and the selector
    in question is a) not something you sent directly and b) recognizable
    as a selector for some other sort of object, a very common cause of
    this is a memory management bug. What typically is happening is that
    there used to be a instance ClassA at that address, but it has gone
    away, and now there is an instance of ClassB. Someone has a stale
    pointer to the object and is messaging it.

    NSZombie is a good first step for tracking down the problem.

    Jim
  • Thx Jim, but not too helpful...

    I am not writing a single line of code, therefore if it is a bug, it
    is a Core Data's bug... and I cannot fix it;
    however, my impression is that it may have to be with the relations
    in my model...
    do I have to make some of them mandatory?
    may be some deleting rule?
    some not obvious attribute I have to set?

    Thanks again,
    Dino

    On Oct 8, 2007, at 4:37 PM, Jim Correia wrote:

    > On Oct 8, 2007, at 5:26 PM, Ricardo Strausz wrote:
    >
    >> I am playing with a Core Data Document based app and found that,
    >> while running and trying to add: an object, the following error
    >> message appears in the console
    >>
    >> 2007-10-08 16:13:57.799 CDD_Curare[1945] *** -[NSCFDictionary
    >> _isMaintainingInverse]: selector not recognized [self = 0x3367b0]
    >> 2007-10-08 16:13:57.800 CDD_Curare[1945] *** NSRunLoop ignoring
    >> exception '*** -[NSCFDictionary _isMaintainingInverse]: selector
    >> not recognized [self = 0x3367b0]' that raised during posting of
    >> delayed perform with target 3b3150 and selector 'invokeWithTarget:'
    >>
    >> Does anybody recognises this?
    >
    > This is really a FAQ.
    >
    > Whenever you see SomeClass: selector not recognized and the
    > selector in question is a) not something you sent directly and b)
    > recognizable as a selector for some other sort of object, a very
    > common cause of this is a memory management bug. What typically is
    > happening is that there used to be a instance ClassA at that
    > address, but it has gone away, and now there is an instance of
    > ClassB. Someone has a stale pointer to the object and is messaging it.
    >
    > NSZombie is a good first step for tracking down the problem.
    >
    > Jim
    >
  • On Oct 8, 2007, at 6:04 PM, Ricardo Strausz wrote:

    > Thx Jim, but not too helpful...
    >
    > I am not writing a single line of code

    How are you establishing relationships between instances?

    My advice remains the same. Enable NSZombie and debug the
    application. That will let you know which zombied instance is being
    messaged. From there you can work backwards to possible causes. Right
    now you 4 entities and no leads.

    Jim
  • > I am not writing a single line of code, therefore if it is a bug, it
    > is a Core Data's bug... and I cannot fix it;
    > however, my impression is that it may have to be with the relations
    > in my model...

      I'm not sure how you can assert it's a Core Data bug when you
    haven't even yet posted the code which produces this error. What
    object are you -add:'ing and how do you create it? To what are you -
    add:'ing it? An array controller?

      Many beginners (to an API, not necessarily programming in general)
    are quick to label things they don't understand as an API bug. 95% of
    the time, they're not just wrong, but ridiculously so. Be careful and
    make sure you post your proof first or your blame is little more than
    noise.

    > do I have to make some of them mandatory?
    > may be some deleting rule?
    > some not obvious attribute I have to set?

      Don't know; you've not provided sufficient information. Please give
    this a read:

    http://www.catb.org/~esr/faqs/smart-questions.html

      ... then post back with the necessary info. My *first* guess is
    that you're either not maintaining memory properly (and the message is
    being sent to some random object which happens to be an NSDictionary)
    or you're trying to add an NSDictionary instance when you really mean
    to add an NSManagedObject. That's about as good as you can get with
    the info you've provided: a guess.

    --
    I.S.
  • Hola IS (and Jim)!
    May be you did not read the last part of the first mail, but here it
    is how to reproduce the error:

    -create a new Core Data Document based app
    -in the model, create 3 entities, say A,B,C
    -in each entity add an attribute, say "string/name" with default
    value "hola", and create the relationships A<-->>B<-->>C
    -in the Document.nib, create 3 array controllers, one for each
    entity, bind them to the file's owner managedDocumentContext and in B
    and C also bind the contentSet to the appropriate controller
    -in the main window add 3 textFields, binding its values to the
    properties of each entity, and add 3 buttons which you will connect
    to the "add:" outlet of each controller.
    -build and run
    -push the buttons in sequence
    -see your console

    Am I missing something?

    Dino

    p.d., I am coding in Xcode 2.0 at a Dual 1.8 G5 w/ Server 10.4.10, if
    this helps at all.

    On Oct 8, 2007, at 5:56 PM, I. Savant wrote:

    >
    >
    >> I am not writing a single line of code, therefore if it is a bug,
    >> it is a Core Data's bug... and I cannot fix it;
    >> however, my impression is that it may have to be with the
    >> relations in my model...
    >
    > I'm not sure how you can assert it's a Core Data bug when you
    > haven't even yet posted the code which produces this error. What
    > object are you -add:'ing and how do you create it? To what are you -
    > add:'ing it? An array controller?

    Please read all the thread before judging...

    >
    > Many beginners (to an API, not necessarily programming in
    > general) are quick to label things they don't understand as an API
    > bug. 95% of the time, they're not just wrong, but ridiculously so.
    > Be careful and make sure you post your proof first or your blame is
    > little more than noise.

    BTW: I had been writing code for more than 30 years... and in Mach
    since NeXT 1.0... so, may be I am making a stupid mistake, but please
    do not call me newbie...

    >
    >> do I have to make some of them mandatory?
    >> may be some deleting rule?
    >> some not obvious attribute I have to set?
    >
    > Don't know; you've not provided sufficient information. Please
    > give this a read:
    >
    > http://www.catb.org/~esr/faqs/smart-questions.html
    >
    > ... then post back with the necessary info. My *first* guess is
    > that you're either not maintaining memory properly (and the message
    > is being sent to some random object which happens to be an
    > NSDictionary) or you're trying to add an NSDictionary instance when
    > you really mean to add an NSManagedObject. That's about as good as
    > you can get with the info you've provided: a guess.
    >
    > --
    > I.S.
    >
    >
  • > May be you did not read the last part of the first mail, but here it
    > is how to reproduce the error:

      Sure I did, but you don't seem to have read the How To Ask
    Questions the Smart Way link you were sent (or you simply ignored it).
    I say this because you're still not providing all the details. See
    below ...

    > -create a new Core Data Document based app

      Okay.

    > -in the model, create 3 entities, say A,B,C

      Done.

    > -in each entity add an attribute, say "string/name" with default
    > value "hola", and create the relationships A<-->>B<-->>C

      Easy enough.

    > -in the Document.nib, create 3 array controllers, one for each
    > entity, bind them to the file's owner managedDocumentContext and in
    > B and C also bind the contentSet to the appropriate controller

      Here's where we run into trouble. What do you mean by 'bind the
    contentSet to the appropriate controller'? The great thing about array
    controllers is they're so flexible, many configurations are
    'appropriate' depending on your application's requirements. What's
    appropriate for yours? Answer: I don't know unless you tell me. Please
    specify *in detail* how these are bound.

      Also, the default settings for an array controller are set to
    "Mode: Class" and "Class Name: NSMutableDictionary". In your project,
    have you set "Mode: Entity" and "Entity Name: appropriate-name-here"?

      Conceivably, if you have not, calling the -add: action on the array
    controller will create a dictionary, not an instance of your entity,
    which could also conceivably produce the error you mentioned (a
    dictionary being sent an improper message).

      It'd help if you'd avail yourself of one of the many file sharing
    sites and upload your project there (or a simplified test case). That
    way, we can see exactly what you're seeing without the need for you to
    provide all the details.

    --
    I.S.
  • Thank you IS!
    that was the error...
    I forgot to change that in the third controller... stupid me!
    Thanks again
    Dino

    On Oct 8, 2007, at 7:39 PM, I. Savant wrote:

    > Also, the default settings for an array controller are set to
    > "Mode: Class" and "Class Name: NSMutableDictionary". In your
    > project, have you set "Mode: Entity" and "Entity Name: appropriate-
    > name-here"?
    >
  • On Oct 8, 2007, at 8:39 PM, I. Savant wrote:

    > Also, the default settings for an array controller are set to
    > "Mode: Class" and "Class Name: NSMutableDictionary". In your
    > project, have you set "Mode: Entity" and "Entity Name: appropriate-
    > name-here"?

    The second and third controllers are misconfigured - they are not in
    Entity mode and they do not have a managed object context.

    Beyond that it is difficult to say if the outcome is the expected one
    since the entities and relationships lack meaningful names, and the
    UI arrangement is atypical.

    Jim
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today