ios - NSObject 可能无法响应 'onEnter'(在 AppDelegate 中使用 iAd 时)

标签 ios cocos2d-iphone iad

使用 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)

怎么了?缺少要继承的任何类?

最佳答案

onEnter 和 onExit 方法仅在从 CCNode 派生的类中可用。您的类是 NSObject 的子类。

如果您手动发送 onEnter/onExit 消息,只需删除对 super onXXX 的调用,因为它是多余的。

关于ios - NSObject 可能无法响应 'onEnter'(在 AppDelegate 中使用 iAd 时),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11329937/

相关文章:

ios - 无法将核心数据文件添加到我现有的项目(版本控制问题)...?

iphone - if 语句将所有语句分组为一个 if 语句

ios - 在 iAd Bannerview iAd Network 中展示广告

ios - SpriteKit - iOS 7 - iAd 集成错误

iOS 5.1 CoreLocation,位置服务图标不消失

ios - 如何在 View 动画时识别点击手势

ios - 如何使用 Swift 3 打电话?

ios - cocos2d画线

cocos2d-iphone - 在 cocos2d 游戏中集成 Gamecenter

iad - 实现 iAd 后得到 ERROR : unable to get the receiver data from the DB