xcode 预期标识符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19521145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Expected Identifier
提问by user2904379
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.
flag 是 BOOL 类型,问题在于“TRUE”我不确定该放什么来将它分配给 flag,我尝试了许多不同的组合。
采纳答案by nhgrif
self.flag = YES;
If you use [self.flag TRUE];you're trying to call a method named TRUEon self.flag...
如果你使用[self.flag TRUE];你试图调用名为方法TRUE上self.flag...
True Objective-C uses YESand NOfor BOOL, but XCode knows what to do with TRUEand FALSE. The biggest problem was the square bracket thing you were trying to do. self.flag = TRUEwould work.
真正的 Objective-C 使用YESand NOfor BOOL,但 XCode 知道如何处理TRUEand FALSE。最大的问题是你试图做的方括号的事情。 self.flag = TRUE会工作。
回答by Hussain Shabbir
Even in square bracket also you can try like this:-
即使在方括号中,您也可以这样尝试:-
[self setFlag:YES];

