簡體   English   中英

RootViewController無法使用“超級”,因為它是根類

[英]RootViewController cannot use 'super' because it is a root class

在閱讀使用基於導航的應用程序的教程時,我決定使用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 ....]完成的。

如何解決問題?

我的決議更簡單。 .m文件中的#import“ ClassHere.h”中存在拼寫錯誤。 這解決了我遇到的問題。

清潔。 這是“運行”下的一個選項。 它將刪除所有自動生成的構建文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM