Open orkenstein opened 10 years ago
Using valueForKey:
with NSDictionary requires a string parameter as per the NSDictionary docs:
"Note that when using key-value coding, the key must be a string."
The EZForm code you've highlighted is also explicitly using NSStrings when fetching the key from orderedKeys which is correct use of the API.
NSDictionary also defers to objectForKey:
in most uses of valueForKey:
Discussion If key does not start with “@”, invokes objectForKey:. If key does start with “@”, strips the “@” and invokes [super valueForKey:] with the rest of the key.
I'm in two minds about whether or not this is an issue. I can't see a lot of use cases for NSNumber keys in a form, but having said that you could easily rewrite that method to read self.choices[key]
and it probably wouldn't cause any harm.
This part of code:
... should use
-(id)objectForKey
instead of-(id)valueForKey
. Otherwise, if u use for example NSNumber as keys, u get: