How to check if a BOOL is null?
- by Sheehan Alam
Is there a way I can check to see if a value is NULL/Nil before assigning it to a BOOL?
For example, I have a value in a NSDictionary that can be either TRUE/FALSE/NULL
mySTUser.current_user_following = [[results objectForKey:@"current_user_following"]boolValue];
When the value is NULL I get the following error
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSNull boolValue]: unrecognized selector sent to instance
I would like to be able to handle the NULL case.