I have this code
if ([args valueForKey:@"showSetupScreen"]) {
BOOL showSetupScreen = [args valueForKey:@"showSetupScreen"];
NSLog(showSetupScreen ? @"YES" : @"NO");
// meetingConfig.showSetupScreen = showSetupScreen;
}
Where args is NSMutableDictionary.
args value in my dictionary is NO but when I set to BOOL showSetupScreen = [args valueForKey:@"showSetupScreen"]; it changes into YES
Can someone help me in comprehending why this could be happening.
Attached Screenshot for your reference

A
NSDictionary(orNSMutableDictionary) cannot directly contain a primitive C type, such asBOOL. Primitive numeric types (including Boolean) inNSDictionaryare wrapped inNSNumberobjects. See Numbers Are Represented by Instances of the NSNumber Class and Most Collections Are Objects.Thus, use
NSNumbermethodboolValueto extract the Boolean from theNSNumber, e.g.,Or, more simply:
E.g., examples with primitive C types, including
BOOL,NSInteger, anddouble:For what it's worth, if you expand the values contained within
args, that will show you the internal types for those values, and you will see that that the value associated withshowSetupScreen(orfooin my example), is not aBOOL, but rather a pointer to a__NSCFBoolean/NSNumber: