0

Boy do I feel stupid. Here is a programming 101 question that I just can't figure out.

BOOL MOMisCompatible = [self.objectModel isConfiguration:nil compatibleWithStoreMetadata:existingPersistentStoreMetadata];

    NSLog(@"%d", (unsigned)MOMisCompatible); // A

    if(MOMisCompatible){
        NSLog(@"The MOM is compatible."); // B
    }
    else{
        NSLog(@"ARGH! The MOM is incompatible."); // C
    }

The NSLog outputs 1 or 0 at A as expected. But neither B nor C outputs anything. I debug by putting a breakpoint at A, but the code never drops into A nor B. What am I missing?

mputnamtennessee
  • 372
  • 4
  • 14
  • 1
    Hmmm; that doesn't make sense. Are you sure that's the actual code? – trojanfoe Apr 15 '16 at 18:56
  • I had it once that a break point didn't get hit even though the log was printed. Check if you have included a `.m`-File somewhere instead of the `.h`-File. – dasdom Apr 15 '16 at 18:57
  • [This](http://stackoverflow.com/questions/541289/objective-c-bool-vs-bool) answer explains the above in best possible way. – Sam92 Apr 15 '16 at 19:45

1 Answers1

1

Maybe there is something related to their typedef, "BOOL" is a signed char and its header is objc.h, "bool" on the other hand is an int with header stdbool.h. Thus when you try to cast it to (unsigned) it actually works

Meta
  • 29
  • 3