• 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
Core Data Inverse To-Many/To-One Bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data Inverse To-Many/To-One Bug?


  • Subject: Core Data Inverse To-Many/To-One Bug?
  • From: Niko Matsakis <email@hidden>
  • Date: Wed, 1 Jun 2005 22:36:08 +0200

Okay, now that I have solving my bindings problem, I am running into some trouble with Core Data. I have seen some other reports of problems involving inverse to-many relationships, so perhaps this is the same problem?

Basically, I have a list of words belonging to a language. When I create a new word, I want to set its "language" property to point at the language object to which it belongs. This is to-one relationship, and has an inverse on the language object called "vocabulary", which is to-many.

In have the following snippet of code:

            NSManagedObject *langobj = [array objectAtIndex:0];
            [wordobj setValue:langobj forKey:@"language"]; // XXX
            NSMutableSet *mutset = [langobj valueForKey:@"vocabulary"];
            [mutset addObject:wordobj];

As you can see, this code attempts to set the "language" property on the Word object to be the appropriate language, and then adds the Word to the vocabulary list.

When running, the line marked "XXX" dies with an exception:

"2005-06-01 22:22:23.302 Flash[24497] *** -[_NSFaultingMutableSet objectAtIndex:]: selector not recognized [self = 0x34f960]
(gdb) continue
2005-06-01 22:22:30.211 Flash[24497] *** -[_NSFaultingMutableSet objectAtIndex:]: selector not recognized [self = 0x34f960]
2005-06-01 22:22:30.218 Flash[24497] *** -[_NSFaultingMutableSet objectAtIndex:]: selector not recognized [self = 0x34f960]
2005-06-01 22:22:30.218 Flash[24497] *** -[_NSFaultingMutableSet objectAtIndex:]: selector not recognized [self = 0x34f960]
2005-06-01 22:22:30.254 Flash[24497] Cannot create BOOL from object () of class NSCFArray"


If I comment out the line, then the code runs fine but the language property of the Word is null; I would expect it to have been set due to the "inverse" nature of the vocabulary property, but it is not.

If I remove the 'inverse' property and leave the code above as it is, everything works fine.

So, am I doing something wrong or is this a coredata bug?

The code for the project is available at http:// smallcultfollowing.com/flash.zip.


thanks, Niko _______________________________________________ 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: Core Data Inverse To-Many/To-One Bug?
      • From: mmalcolm crawford <email@hidden>
    • Re: Core Data Inverse To-Many/To-One Bug? [RESOLVED]
      • From: Niko Matsakis <email@hidden>
  • Prev by Date: Re: glyphWithName: broken on Tiger ?
  • Next by Date: Equalizing Width of all Toolbar Items
  • Previous by thread: [Moderator] EOT Re: glyphWithName: broken on Tiger ?
  • Next by thread: Re: Core Data Inverse To-Many/To-One Bug? [RESOLVED]
  • Index(es):
    • Date
    • Thread