开发者

iAds Throwing Error

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?


Turned out the error was related to Apple not sending the iAds. I tried it after a while and everything started working fine!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜