I’ve been trying to figure out why this code is not getting hit. The log says either “Success 1” or “Success 0″ so I figured I could just use @”1″ or @”0” in an if statement, but it’s not going through either section.
NSString *success = [JSON valueForKey:@"Success"];
NSLog(@"Success %@", success);
if (success == @"1") {
[self performSegueWithIdentifier:@"loginToInvite" sender:self];
} else if (success == @"0")
{
_logInBtn.selected = NO;
_popupLbl.hidden = NO;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Text" message:@"Text" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil];
[alert show];
}
Thank you for your answers!
Your check for string equality won’t work as that is checking for identity (if the objects are the same object)
You instead, want to check equality, which in the case of strings is true if the values are the same. You should instead use this: