Hi there,
I'm a bit confused with key value coding and to-many relationships. I've read that when having such relationship I should use [object mutableArrayValueForKey:@"key"]; to retrieve the mutable array that holds the objects in that ordered relationship.
What I don't understand is what's the difference between mutableArrayValueForKey or just valueForKey.
Let me illustrate with an example (array is an NSMutableArray of self setup as a property):
id array1= [self valueForKey:@"array"];
NSLog(@"first element %@",[array1 objectAtIndex:1]);
id array2 = [self mutableArrayValueForKey:@"array"];
NSLog(@"first element %@",[array2 objectAtIndex:1]);
Both calls return exactly the same. In that case, what is the benefit or different of the second one?
Cheers!