Core Data Inverse To-Many/To-One Bug?
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