mutableSetValueForKey:, addObject:, and selector not found
mutableSetValueForKey:, addObject:, and selector not found
- Subject: mutableSetValueForKey:, addObject:, and selector not found
- From: Niko Matsakis <email@hidden>
- Date: Thu, 2 Jun 2005 10:37:53 +0200
When I try to run the following Core Data code:
NSMutableSet *mutset = [langobj mutableSetValueForKey:@"vocabulary"];
[mutset addObject:words[i]];
I get some error during the call to addObject: call; specifically:
2005-06-02 10:19:13.320 Flash[25280] *** -[_NSFaultingMutableSet
objectAtIndex:]: selector not recognized [self = 0x351850]
2005-06-02 10:19:13.325 Flash[25280] *** -[_NSFaultingMutableSet
objectAtIndex:]: selector not recognized [self = 0x351850]
2005-06-02 10:19:13.342 Flash[25280] *** -[_NSFaultingMutableSet
objectAtIndex:]: selector not recognized [self = 0x351850]
2005-06-02 10:19:13.343 Flash[25280] *** -[_NSFaultingMutableSet
objectAtIndex:]: selector not recognized [self = 0x351850]
2005-06-02 10:19:14.897 Flash[25280] Cannot create BOOL from object
(1) of class NSCFArray
The relationship (@"vocabulary") in question is a simple "to-many"
relationship to another type of entity, of which words[i] is a newly
created instance. This code used to run okay if I used
'setValueForKey:', but then I found that the relevant key value
methods were not being invoked and so parts of my display were not
updated. Switched to mutableSetValueForKey: seems to cause other
problems. The word properties, if it matters, are some text
(NSString) and a boolean value.
So, I tried expanding mutableSetValueForKey: into the following code:
NSSet *changedObjects = [NSSet setWithObject:words[i]];
[langobj willChangeValueForKey:@"vocabulary"
withSetMutation:NSKeyValueUnionSetMutation
usingObjects:changedObjects];
[[langobj primitiveValueForKey: @"vocabulary"] addObject: words[i]];
[langobj didChangeValueForKey:@"vocabulary"
withSetMutation:NSKeyValueUnionSetMutation
usingObjects:changedObjects];
Sure enough, I get the same error in the call to
didChangeValueForKey:withSetMutation:usingObjects:. I also tried
removing the bindings that would be interested in this change to see
if that made things work, but it doesn't. I get the same error. I
know I have seen this before; I thought I had dodged it, but I
realize all I had done was stop using mutableSetValueForKey: and
hence posting the didChangeValueForKey: message.
Any clues as to what the problem could be appreciated. It seems like
other people ran into similar sounding problems when deleting items,
but that wouldn't apply here.
The project is online at http://smallcultfollowing.com/Flash.zip if
you are truly motivated to help me.
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