My first thought, if odendi
is supposed to represent a BOOL, then why not use it as one?
if ([odeme.odendi boolValue]) {
odeme.odendi = @NO;
} else {
odeme.odendi = @YES;
}
Or even eliminate the if-else
structure.
odeme.odendi = [NSNumber numberWithBool:![odeme.odendi boolValue]];
Or as Martin suggests some different syntax for the same statement:
odeme.odendi = @(![odeme.odendi boolValue]);
Don't miss that exclamation point.
Given that this seems to work on 32-bit and not on 64-bit, I suspect this might be the problem:
if (odeme.odendi == [NSNumber numberWithInt:1])
Which is why you should have put a log in each branch instead of just below it all. It would let you know that your if
is evaluating incorrectly and the problem is here, rather than inside either branch.
You could try [NSNumber numberWithInteger:1]
, which is different between 32-bit and 64-bit. I have no idea if this will actually work or not. At the end of the day though, you say odeme.odendi
is a BOOL. It should be used as such. Don't compare it to a number. Don't even compare it to an [NSNumber numberWithBOOL:YES]
or @YES
. Just grab the BOOL value. It will evaluate to YES or NO and the correct branch should be chosen.