Xcode 4.3“预期标识符或'('”

时间:2012-06-24 18:42:52

标签: iphone xcode sdk

所以我刚刚创建了一个新项目,它在我触摸文件之前显示错误,我是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

并显示“@interface”ViewController.h中的标题中的错误“”

2 个答案:

答案 0 :(得分:8)

这是错误。你想要@interface ViewController

答案 1 :(得分:0)

@interface ViewController


@end 

导入标题时,必须使用" "<>框架。

@interface是一个Objective-c对象,在本例中是一个类,因此您不需要""