0

iAdの使用。警告がほとんど表示されません。以下は私がAppDelegate.mに入れたコードです

何が欠けている?

警告はコード行の終わりで示されます

-(void)onEnter
{
    [super onEnter]; //<-- NSObject may not respond to this
    adView = [[ADBannerView alloc]initWithFrame:CGRectZero];
    adView.delegate = self;
    adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifierLandscape, ADBannerContentSizeIdentifierLandscape, nil];
    adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
    [[[CCDirector sharedDirector] openGLView] addSubview:adView];
    adView.hidden = YES;
}


-(void)onExit
{
    adView.delegate = nil;
    [adView removeFromSuperview];
    [adView release];
    adView = nil;
    [super onExit]; //<-- NSObject may not respond to this
}



-(void)bannerViewActionDidFinish :(ADBannerView *)banner
    {    
        NSLog(@"bannerViewActionDidFinish called");
        [[UIApplication sharedApplication] setStatusBarOrientation :(UIInterfaceOrientation)[[CCDirector sharedDirector] deviceOrientation]];
    }
//<-- Instance method deviceOrientation not found (return type defaults to id)

なにが問題ですか?継承するクラスがありませんか?

4

3 に答える 3

1

から継承する必要がありCCNodeますNSObject

編集さらに、deviceOrientationメンバーではないのに、CCDirectorなぜそうだと思いますか?

于 2012-07-04T14:00:08.927 に答える
1

onEnterメソッドとonExitメソッドは、CCNodeから派生したクラスでのみ使用できます。クラスはNSObjectからサブクラス化されています。

onEnter / onExitメッセージを手動で送信する場合は、不要なため、superonXXXへの呼び出しを削除するだけです。

于 2012-07-04T14:01:26.167 に答える
0

おそらくスーパークラスに実装されている、呼び出しているメソッドがに@implementation公開されていないため、警告が表示されます@interface.hスーパークラスファイルで宣言するだけです。

- (UIDeviceOrientation)deviceOrientation;
- (void)onExit;
- (void)onEnter;

それらを公開したくない場合は、.mそれらが存在することがわかっているので、サブクラスファイルのカテゴリでそれらを宣言します。

于 2012-07-04T13:35:58.497 に答える