iAds 抛出错误

发布于 2024-10-01 13:23:57 字数 2956 浏览 0 评论 0原文

我收到以下错误:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何时共饮酒 2024-10-08 13:23:57

事实证明,该错误与 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文