Possible Duplicate:
Using valueForKeyPath on NSDictionary if a key starts the @ symbol?
Error:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<__NSDictionaryI 0x100110e00> valueForUndefinedKey:]:
this class is not key value coding-compliant for the key .'
Example code:
NSDictionary *dict = @{ @"foo": @"bar" };
NSLog(@"foo=%@, qaz=%@", [dict valueForKey:@"foo"], [dict valueForKey:@"qaz"]);
NSLog(@"@=%@", [dict valueForKey:@"@"]); // SIGABRT
This also happens when using [dict objectForKey:@"@"]
.
Even when the "@" key is defined it still causes SIGABRT
:
NSDictionary *dict = @{ @"@": @"at-sign" };
NSLog(@"@=%@", [dict valueForKey:@"@"]); // SIGABRT
Why is this happening and how can I retrieve the value for the "@" key from the dictionary?