Objective-C - Comparing integers not working as expected Objective-C - Comparing integers not working as expected json json

Objective-C - Comparing integers not working as expected


You are comparing a pointer to an object, not an integer itself. You must first convert the object into an integer:

if ([[userDictionary objectForKey:@"userid"] integerValue] == -1){     //Do stuff}