在阅读使用基于导航的应用程序的教程时,我决定使用我的 3.2.6-Xcode 创建一个基于导航的应用程序,并使用 Xcode 4.2 打开它,以便按照该版本的教程进行操作。但是当我在 Xcode 4.2 中打开同一个项目(不更改或添加任何代码)时,4.2 Xcode 给了我 2 个错误说:
RootViewController 不能使用“超级”,因为它是根类
现在,我的 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 ....] 完成的。
如何解决问题?