I don't understand the differences between these ways of accessing NSDictionary
values
[my_dict objectForKey:@"field"]
[my_dict valueForKey:@"field"]
my_dict[@"field"]
Can someone tell me ?
I don't understand the differences between these ways of accessing NSDictionary
values
[my_dict objectForKey:@"field"]
[my_dict valueForKey:@"field"]
my_dict[@"field"]
Can someone tell me ?
[my_dict objectForKey:@"field"]
is an NSDictionary
method. It accepts any type of object.
[my_dict valueForKey:@"field"]
is KVC method. It accepts only NSString
.
my_dict[@"field"]
is same as objectForKey:
. This is new feature added.