Iphone Xcode 4.3“预期的标识符或“(”)
因此,我刚刚创建了一个新项目,它在我接触该文件之前就显示了错误,我对Xcode非常陌生,但下面是我的代码:Iphone Xcode 4.3“预期的标识符或“(”),iphone,xcode,sdk,Iphone,Xcode,Sdk,因此,我刚刚创建了一个新项目,它在我接触该文件之前就显示了错误,我对Xcode非常陌生,但下面是我的代码: #import "ViewController.h" @interface "ViewController.h" @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the vie
#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
在@interface ViewController.h的标签中显示了错误,这就是错误。您想要@interface ViewController。就是错误
@interface ViewController
@end
在导入标题和框架时,必须使用
@接口是一个objective-c对象,在本例中是一个类,因此您不需要。@interface ViewController,或者您可以删除接口部分,然后取消注释导入ViewController.h。不要忘记用√ 按钮!@Alexander Akers这不起作用,这就是为什么我测试这个东西,因为它需要一个类扩展。请尝试删除该部分或将其放在ViewController之后。