- (nullable ObjectType)valueForKey:(NSString *)key;
valueForKey was accepting till Xcode 12.x with all types of keys (e.g. "apple" and "Apple"), which is not working with Xcode 13.x for key "apple" when in Dictionary has "Apple" key is available
valueForKey was accepting till Xcode 12.x with all types of keys (e.g. "apple" and "Apple"), which is not working with Xcode 13.x for key "apple" when in Dictionary has "Apple" key is available
On what platform and OS version do you see -[valueForKey:]
behaving case insensitive? Can you post (using “code block” formatting) a minimalist code example that demonstrates this? Key/value containers are always supposed to be case-sensitive.
Here’s what I meant by a minimalist code example using “code block” formatting:
NSDictionary *dict = [NSDictionary dictionaryWithObject: @"a" forKey: @"Apple"];
NSAssert(([dict valueForKey: @"Apple"] != nil), @"");
NSAssert(([dict valueForKey: @"apple"] == nil), @"");
(This formatting works only in a top-level reply; as you can see, posting code in a comment doesn’t work well.)
Returning to the clarifying questions from above: On what platform does this occur: iOS? macOS? And what OS: iOS 13? iOS 14? iOS 15? The version of Xcode itself isn’t really important.
How are you verifying that myAppleDictionary
contains the exact keys and values you expect?
If you run the code example given above in both of your scenarios, what happens?