I have a JSON response from a web server that looks like this:
{"success":true, "token":"123456"}
and I want to use that in an if statement, and compare it with "YES".
However, doing this doesn't work:
NSDictionary *response = [response JSONValue]; // the JSON value from webservice response, converted to NSDictionary
if ([response objectForKey:@"success"]){} // does not work
if ([response objectForKey:@"success"] == YES){} // does not work
if ([[response objectForKey:@"success"] integerValue] == YES) {} // does not work...erroneous probably
How can I work around this? Typecasting in Boolean yields a warning too