I don't understand why an object is not removed from an NSMutableArray. This is the code:
[self willChangeValueForKey:@"candidatesProxy"];
[candidatesProxy removeObject:[[pseudonymsArrayController selectedObjects] lastObject]];
[self didChangeValueForKey:@"candidatesProxy"];
I've checked and the lastObjet in pseudonyms is the same object of candidatesProxy. But it is not removed.
Is it because maybe the object has been copied to a different memory location, so I actually have 2 objects rather then one ?
Thanks
You cannot remove objects from NSArray
, you can remove it only from NSMutableArray
EDIT
Just try the following statements before willChangeValueForKey:
NSLog(@"Array : %@", candidatesProxy);
NSLog(@"Element : %@",[[pseudonymsArrayController selectedObjects] lastObject]);
and check whether the lastObject element is present in the array.