RootViewController不能使用' super'因为它是一个根类

时间:2012-05-29 11:55:05

标签: ios xcode xcode4 xcode4.2 xcode3to4

在浏览使用基于导航的应用程序的教程时,我决定使用我的3.2.6-Xcode创建一个基于导航的应用程序,并使用Xcode 4.2打开它以跟随该版本的教程。 但是当我在Xcode 4.2中打开相同的项目(没有更改或添加任何代码)时,4.2 Xcode给了我2个错误说:

  

RootViewController不能使用'super',因为它是一个根类

现在,我的Xcode有4个类文件:RootViewController.h,RootViewController.m,SaveUpAppDelegate.h和SaveUpAppDelegate.m。错误发生在RootViewController.m

- (void)dealloc {
    [super dealloc];
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Relinquish ownership any cached data, images, etc that aren't in use.
}

我已经在网上搜索并发现了这个讨论(http://stackoverflow.com/questions/10113669/xcode-4-3-2-gives-error-cannot-use-super-because-it-is- a-root-class)他们说原因可能是控制器是开发人员忘记了@interface行中的超类。这不符合我的情况,因为我(或更好:Xcode 3.2.6)没有忘记RootViewController.h中的超类......

#import <UIKit/UIKit.h>

@interface RootViewController : UITableViewController {
}

@end

现在,我评论了这些关键线并且它工作正常,但我确定,我需要这些线,因为m文件中的大多数自动创建的线都是用[super .... ]

如何解决问题?

2 个答案:

答案 0 :(得分:4)

我的解决方案更简单。 .m文件中的#import“ClassHere.h”中存在拼写错误。这解决了我遇到的问题。

答案 1 :(得分:2)

清洁。这是“运行”下的一个选项。它会删除自动生成的所有构建文件。

相关问题