XCode for IOS 中的预期表达式错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17603525/
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 Expression error in XCode for IOS
提问by George523
Thanks for all your help previously! I have finally created a functioning Open GL game. Only problem is that there is an error in the most basic part of the UI. The IBAction.Here is a screenshot of XCode at the time of the error (yes I finally can put in images!)
感谢您之前的所有帮助!我终于创建了一个正常运行的 Open GL 游戏。唯一的问题是 UI 的最基本部分存在错误。该IBAction为。这是出错时 XCode 的屏幕截图(是的,我终于可以放入图像了!)
The code
编码
-(IBAction)returnpress
{
cruzia.hidden = 0;
textarea.hidden = 0;
playbtn.hidden = 0;
tutorialbtn.hidden = 0;
optionsbtn.hidden = 0;
trainingbtn.hidden = 0;
back.hidden = 1;
soundlbl.hidden = 1;
music.hidden = 1;
sound.hidden = 1;
musiclbl.hidden = 1;
cruzia.text = @"Cruzia";
textarea.text = @"";
if (clicked == 1) {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef =CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"click", CFSTR ("electronic click.wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
}
Is always bringing up the error: expected expressionIf anyone can tell me how to rid myself of this error, I would be very appreciative.
总是提出错误:expected expression如果有人能告诉我如何摆脱这个错误,我将不胜感激。
-George
-乔治
回答by Jim
The problem is not with that method, it is with the one before it. You forgot to close the previous method with a closing curly brace.
问题不在于那个方法,而在于它之前的方法。您忘记使用右花括号关闭前一个方法。