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