I spent some time today chasing two errors, and ended up fixing both of them using the same solution.
Now that I have a solution, I was hoping to get some clarity.
I am comparing an attribute from Core Data (Integer 16 / NSNumber) with Integer (ABPropertyID and ABMultiValueIdentifier).
The error in this comparison, and, oddly enough, showed up only after I killed the application (from the background tray), opened it again and skipped the same process that included the comparison. Anyway...
This is what stopped working after reboot:
if (myNumber.aProperty == [NSNUmber numberWithInt:anInteger]) { /* do stuff here */ }
And these are two solutions that still work perfectly:
if ([myNumber.aProperty integerValue] == anInteger) {/* do stuff here */ }
if ([myNumber.aProperty isEqualToNumber:[NSNumber numberWithInt:anInteger]]) { /* do stuff here */ }
To me they all look the same. I always either convert NSNumber to integerValue, or convert an integer to NSNumber.
Any ideas?