I'm new to Objective C, and I'm trying to call a method on an array (NSArray) of objects directly like this:
[[myPeople objectAtIndex: 0] setName: @"Shane"];
But this doesn't seem to work, and returns a warning saying "Multiple methods named 'setName' found"
I can successfully perform the operation in this manner:
Person* person = [myPeople objectAtIndex: 0];
[person setName: @"Shane"];
Is my syntax simply incorrect in the first case, or should the second piece of code be used? Or is there a better way that I'm not aware of?
Thanks, any help is greatly appreciated
setName:where the argument or return type are different, then you are writing code against the recommended conventions of the system. Rename one of the methods.