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

编程入门 行业动态 更新时间:2024-10-26 22:21:43
RootViewController不能使用'super',因为它是一个根类(RootViewController cannot use 'super' because it is a root class)

在阅读使用基于导航的应用程序的教程时,我决定使用我的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 { } @end

right 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.

更多推荐

本文发布于:2023-08-04 12:27:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1416130.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:是一个   因为它   super   RootViewController   root

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!