How to convert and compare NSNumber to BOOL?

You currently compare two pointers. Use NSNumbers methods instead to actually compare the two:

if([someNSNumberValue isEqualToNumber:[NSNumber numberWithBool:NO]]) {
    // ...
}

To get the bool value from a NSNumber use -(BOOL)boolValue:

BOOL b = [num boolValue];

With that the comparison would be easier to read for me this way:

if([num boolValue] == NO) {
    // ...
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)