2

最近、xcode 4.3.2 に更新したときに、新しい問題が多数発生しました。アプリ ビュー コントローラーの m ファイルで、「ルート句であるためスーパーを使用できません」というエラーが表示され続けます。

私は何時間もインターネットを見てきましたので、助けていただければ幸いです。

ありがとう

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:    (UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

@end
4

3 に答える 3

8

このエラーは、クラスが別のカスタム クラスから継承している場合や@class MyAncestorClass、ヘッダー ファイルで祖先クラスの前方宣言 ( ) を使用し#importているが、実装ファイルで祖先クラスを忘れている場合にも発生する可能性があります。

于 2012-04-19T21:15:04.487 に答える
4

クラスを宣言したとき、行のスーパークラスを忘れた可能性があります@interface。たとえば、あなたは

@interface MyClass
{
    // ... ivars ...
}

// ... methods ...

@end

最初の行を次のようにします。

@interface MyClass : NSObject

または使用する予定のスーパークラス。

于 2012-04-11T21:14:59.257 に答える
-1

このソリューションを使用すると、phonegap でこの問題が発生した場合に役立ちます

#import <Cordova/CDVViewController.h>
#import <Cordova/CDVCommandDelegateImpl.h>
#import <Cordova/CDVCommandQueue.h>

@interface MainViewController : CDVViewController
@end

@interface MainCommandDelegate : CDVCommandDelegateImpl
@end

@interface MainCommandQueue : CDVCommandQueue
@end
于 2013-04-29T13:12:06.070 に答える