Search code examples
objective-cxcodeidentifier

Expected Identifier


I realize this is probably a simple solution but I've been looking around I can't seem to figure this out.

[self.flag TRUE];

flag is of type BOOL the problem is with the "TRUE" I'm unsure what to put to assign it to flag and I've tried a number of different combinations.


Solution

  • self.flag = YES;
    

    If you use [self.flag TRUE]; you're trying to call a method named TRUE on self.flag...

    True Objective-C uses YES and NO for BOOL, but XCode knows what to do with TRUE and FALSE. The biggest problem was the square bracket thing you were trying to do. self.flag = TRUE would work.