在阅读使用基于导航的应用程序的教程时,我决定使用我的3.2.6-Xcode创建一个基于导航的应用程序,并使用Xcode 4.2打开它,以便跟随该版本的教程。 但是当我在Xcode 4.2中打开同一个项目(不更改或添加任何代码)时,4.2 Xcode给了我两个错误:
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他们说,原因可能是控制器是开发人员在@interface行中忘记了超类。 这不适合我的情况,因为我(或更好:Xcode 3.2.6)不会忘记RootViewController.h的超类...
#import <UIKit/UIKit.h> @interface RootViewController : UITableViewController { } @end现在,我评论了这些关键线,它工作正常,但我确定,我将需要这些线,因为m文件中的大多数自动创建的线都是用[super ....]完成的。
如何解决问题?
While going through a tutorial which uses a navigation based- application, I decided to create a Navigation-Based Application with my 3.2.6-Xcode and open it with Xcode 4.2 for following the tutorial with that version. But when I open the same project in Xcode 4.2 (without changing or adding any code), the 4.2 Xcode gives me 2 errors saying:
RootViewController cannot use 'super' because it is a root class
Right now, my Xcode has 4 class-files: RootViewController.h, RootViewController.m, SaveUpAppDelegate.h and SaveUpAppDelegate.m. The error is in RootViewController.m:
- (void)dealloc { [super dealloc]; }and
- (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. }I already searched through the internet and found this discussion (http://stackoverflow.com/questions/10113669/xcode-4-3-2-gives-error-cannot-use-super-because-it-is-a-root-class) and they say that the reason might be that the controller is that the developer forgot the superclass in the @interface line. That doesn't fit to my case, because I (or better: Xcode 3.2.6) didn't forget the superclass in RootViewController.h...
#import <UIKit/UIKit.h> @interface RootViewController : UITableViewController { } @endright now, I commented those critical lines out and it works fine, but I'm sure, I'll need those lines since most of the automatic created lines in the m-file are done with [super ....].
How to solve the problem?
最满意答案
清洁。 这是“运行”下的一个选项。 它删除所有自动生成的构建文件。
Clean. It's an option under "Run". It removes all the build files that are automatically generated.
更多推荐
发布评论