[英]Xcode 4.3 “Expected identifier or '('”
So I have just created a new project and it is showing errors before I even had touched the file, Im very new to Xcode but here is my code: 因此,我刚刚创建了一个新项目,在我甚至没有触摸文件之前,它就显示错误。我对Xcode来说还很陌生,但这是我的代码:
#import "ViewController.h"
@interface "ViewController.h"
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
@end
And it is shown the error that is in the titel at " @interface "ViewController.h" " 并显示在“ @interface“ ViewController.h”“中的标题中的错误
That is the error. 那是错误。 You want @interface ViewController
. 您需要@interface ViewController
。
It is 它是
@interface ViewController
@end
You have to use " "
when you are importing an header, <>
a framework. 导入标头( <>
框架)时必须使用" "
。
@interface
is an objective-c object, in this case a class, so you don't need the ""
. @interface
是一个Objective-C对象,在这种情况下是一个类,因此您不需要""
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.