代码之家  ›  专栏  ›  技术社区  ›  azamsharp

iAds投掷错误

  •  0
  • azamsharp  · 技术社区  · 14 年前

    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
    

    以下是我的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 回复  |  直到 14 年前
        1
  •  0
  •   azamsharp    14 年前

    结果发现这个错误与苹果没有发送iAds有关。过了一会儿我试了一下,一切都开始好起来了!