iAds投掷错误

时间:2010-11-09 16:30:35

标签: iphone cocos2d-iphone iad

我收到以下错误:

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];

}

我可以看到游戏正在运行但我没有看到任何广告显示。我是否必须以某种方式定位广告或其他内容?

1 个答案:

答案 0 :(得分:0)

原来这个错误与Apple没有发送iAd有关。过了一会儿我试了一下,一切都运转正常!