在学习使用基于导航的应用程序的教程时,我决定使用我的 3.2.6-Xcode 创建一个基于导航的应用程序,并使用 Xcode 4.2 打开它,以便按照该版本的教程进行操作。
但是当我在 Xcode 4.2 中打开同一个项目(不更改或添加任何代码)时,4.2 Xcode 给了我 2 个错误说:
RootViewController cannot use 'super' because it is a root class
现在,我的 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),他们说原因可能是 Controller 是开发人员忘记了
@interface
中的父类(super class)。线。这不适合我的情况,因为我(或更好:Xcode 3.2.6)没有忘记 RootViewController.h
中的父类(super class)...#import <UIKit/UIKit.h>
@interface RootViewController : UITableViewController {
}
@end
现在,我将这些关键行注释掉了,它工作正常,但我敢肯定,我需要这些行,因为 m 文件中的大多数自动创建的行都是用 [super ....] 完成的。
如何解决问题?
最佳答案
我的决议更简单。 .m 文件中的#import "ClassHere.h"有拼写错误。这解决了我遇到的问题。
关于ios - RootViewController 不能使用 'super' 因为它是根类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10798637/