In xcode, when _nice is 0, it still performs [self ifsss]. Why would that be when I clearly state it should say “worked” in the log?
NSLog(@"nice is %@", _nice);
if (_nice != @"0") {
[self ifsss];
NSLog(@"Should not have worked %@", _nice);
}
else {
NSLog(@"worked %@", _nice);
}
The NSLog results are below:
- nice is 22
- Should not have worked 22
Assuming
_niceis anNSString, you need to do:You can’t use basic comparison operators with objects, only basic types like
intorfloat.