I want to use valueForKeyPath
on my NSDictionary
, but the problem is that one of the keys is a string that starts with the @ symbol. I have no control over the naming of the key.
I'm having problems trying to create the key path as I'm getting a format exception, even when trying to escape the @ symbol:
This works fine:
[[[dict objectForKey:@"key1"] objectForKey:@"@specialKey"] objectForKey:@"key3"]
However none of these work:
[dict valueForKeyPath:@"[email protected]"]
[dict valueForKeyPath:@"key1.@@specialKey.key3"]
Any ideas?
Thanks,
Mike