I have a crazy problem when comparing an NSInteger to int, as follows:
NSInteger count = [dictionary count];
if (count == 0) {
// Do something
}
else {
// Do something
}
When the count is zero, the snipped code in the if clause is run, but when the count number is changed, the snipped code in the if clause is not run (this is correct), but the snipped code in the else clause is not run either. When I debug, the cursor always jumps over the else clause.
I tried to change count number to int or compare it as an NSNumber, but nothing changed.
Does anyone know how to solve this problem?