iAds 抛出错误
我收到以下错误:
2010-11-08 19:47:08.190 One2ThreePop[325:207] didFailToReceiveAdWithError
2010-11-08 19:47:10.990 One2ThreePop[325:207] The operation couldn’t be completed. Banner view is visible but does not have content
2010-11-08 19:47:10.991 One2ThreePop[325:207] didFailToReceiveAdWithError
2010-11-08 19:47:12.389 One2ThreePop[325:207] The operation couldn’t be completed. Ad inventory unavailable
2010-11-08 19:47:12.390 One2ThreePop[325:207] didFailToReceiveAdWithError
2010-11-08 19:47:12.590 One2ThreePop[325:207] The operation couldn’t be completed. Ad inventory unavailable
2010-11-08 19:47:12.591 One2ThreePop[325:207] didFailToReceiveAdWithError
2010-11-08 19:47:13.374 One2ThreePop[325:207] The operation couldn’t be completed. Ad inventory unavailable
2010-11-08 19:47:13.375 One2ThreePop[325:207] didFailToReceiveAdWithError
如上所述,didFailToReceiveAdWithError 已正确触发。我的应用程序通过 iTunes 连接启用了 iAd。我正在使用 xCode 3.2.4 和 iOS 4.1。
这是我的 Cocos2d 应用程序的完整代码:
ABCPopAppDelegate.m
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
CC_DIRECTOR_INIT();
NSLog(@"applicationDidFinishLaunching");
MainViewController *controller = [[MainViewController alloc] init];
[window addSubview: controller.view];
}
MainViewController.h
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
#import "cocos2d.h"
#import "ABCPopGameScene.h"
@interface MainViewController : UIViewController<ADBannerViewDelegate> {
ADBannerView *bannerView;
}
@property (nonatomic,retain) ADBannerView *bannerView;
@end
MainViewController.m:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
// Obtain the shared director in order to...
CCDirector *director = [CCDirector sharedDirector];
// Sets landscape mode
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
// Turn on display FPS
[director setDisplayFPS:NO];
// Turn on multiple touches
EAGLView *eaglView = [director openGLView];
[eaglView setMultipleTouchEnabled:YES];
[self.view addSubview:eaglView];
self.bannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
[self.bannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects:
ADBannerContentSizeIdentifier320x50,
ADBannerContentSizeIdentifier480x32, nil]];
self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[self.bannerView setDelegate:self];
[self.view addSubview:self.bannerView];
// [self.view addSubview:eaglView];
// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change anytime.
[CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
[[CCDirector sharedDirector] runWithScene: [ABCPopGameScene scene]];
NSLog(@"viewDidLoad fired!");
//[self moveBannerOffScreen];
}
我可以看到游戏正在运行,但没有看到任何广告显示。我是否必须以某种方式放置广告或其他什么?
I am getting the following error:
2010-11-08 19:47:08.190 One2ThreePop[325:207] didFailToReceiveAdWithError
2010-11-08 19:47:10.990 One2ThreePop[325:207] The operation couldn’t be completed. Banner view is visible but does not have content
2010-11-08 19:47:10.991 One2ThreePop[325:207] didFailToReceiveAdWithError
2010-11-08 19:47:12.389 One2ThreePop[325:207] The operation couldn’t be completed. Ad inventory unavailable
2010-11-08 19:47:12.390 One2ThreePop[325:207] didFailToReceiveAdWithError
2010-11-08 19:47:12.590 One2ThreePop[325:207] The operation couldn’t be completed. Ad inventory unavailable
2010-11-08 19:47:12.591 One2ThreePop[325:207] didFailToReceiveAdWithError
2010-11-08 19:47:13.374 One2ThreePop[325:207] The operation couldn’t be completed. Ad inventory unavailable
2010-11-08 19:47:13.375 One2ThreePop[325:207] didFailToReceiveAdWithError
As noted above the didFailToReceiveAdWithError is being fired correctly. The iAds are enabled for my application through iTunes connect. I am using xCode 3.2.4 and iOS 4.1.
Here is my complete code for Cocos2d application:
ABCPopAppDelegate.m
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
CC_DIRECTOR_INIT();
NSLog(@"applicationDidFinishLaunching");
MainViewController *controller = [[MainViewController alloc] init];
[window addSubview: controller.view];
}
MainViewController.h
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
#import "cocos2d.h"
#import "ABCPopGameScene.h"
@interface MainViewController : UIViewController<ADBannerViewDelegate> {
ADBannerView *bannerView;
}
@property (nonatomic,retain) ADBannerView *bannerView;
@end
MainViewController.m:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
// Obtain the shared director in order to...
CCDirector *director = [CCDirector sharedDirector];
// Sets landscape mode
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
// Turn on display FPS
[director setDisplayFPS:NO];
// Turn on multiple touches
EAGLView *eaglView = [director openGLView];
[eaglView setMultipleTouchEnabled:YES];
[self.view addSubview:eaglView];
self.bannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
[self.bannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects:
ADBannerContentSizeIdentifier320x50,
ADBannerContentSizeIdentifier480x32, nil]];
self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[self.bannerView setDelegate:self];
[self.view addSubview:self.bannerView];
// [self.view addSubview:eaglView];
// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change anytime.
[CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
[[CCDirector sharedDirector] runWithScene: [ABCPopGameScene scene]];
NSLog(@"viewDidLoad fired!");
//[self moveBannerOffScreen];
}
I can see the game running but I do not see any ads displayed. Do I have to somehow position the ads or something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,该错误与 Apple 未发送 iAd 相关。一段时间后我尝试了一下,一切开始正常!
Turned out the error was related to Apple not sending the iAds. I tried it after a while and everything started working fine!