You can't use @
in the keys in conjunction with valueForKey:
. NSDictionary
has some documented but perhaps unexpected behavior in that case: it strips the @
and invokes [super valueForKey:]
with the new key. That looks for the key on the object, not in the dictionary's contents. No such key exists on instances of NSDictionary
, so an exception is raised.
You should in general use objectForKey:
to retrieve values from an NSDictionary
.
Credit must go to Ken Thomases for his comments below, correcting earlier versions of this answer.