cocos2d-iphone - iads 与 cocos2d 的集成

标签 cocos2d-iphone

我正在尝试将 iads 集成到我的 cocos2d 应用程序中。在 ABCPopAppDelegate 文件实现中,我有以下代码:

- (void) applicationDidFinishLaunching:(UIApplication*)application
{
    // wrapper controller class 

    // CC_DIRECTOR_INIT()
    //
    // 1. Initializes an EAGLView with 0-bit depth format, and RGB565 render buffer
    // 2. EAGLView multiple touches: disabled
    // 3. creates a UIWindow, and assign it to the "window" var (it must already be declared)
    // 4. Parents EAGLView to the newly created window
    // 5. Creates Display Link Director
    // 5a. If it fails, it will use an NSTimer director
    // 6. It will try to run at 60 FPS
    // 7. Display FPS: NO
    // 8. Device orientation: Portrait
    // 9. Connects the director to the EAGLView
    CC_DIRECTOR_INIT();

    CCDirector *director = [CCDirector sharedDirector];
    CGSize winSize = [director winSize]; 
    MainViewController *controller = [[MainViewController alloc] init]; 
    controller.view.frame = CGRectMake(0,winSize.height-50 , 320, 50);
    controller.view.hidden = YES;

    controller.bannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];

    //controller.bannerView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
    //controller.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;

    [controller.bannerView setDelegate:controller]; 

    [controller.view addSubview:controller.bannerView];

我收到以下错误:
"_OBJC_CLASS_$_ADBannerView", referenced from:

这意味着什么?

最佳答案

您收到该错误是因为您尚未在 XCode 上将 iADFramework 添加到您的目标。确保将其添加为 WEAK 引用,以便它不会在运行 <4.0 iOS 的设备上中断。不要忘记使 RootViewController 符合 ADBannerViewDelegate。

如上所述,我还建议您阅读一个不错的教程。我喜欢这个:

http://xcode4all.wordpress.com/2011/06/10/how-to-add-iad-banner-in-iphone-app/

还有这个:

http://useyourloaf.com/blog/2010/11/27/iad-framework-updates-for-ios-42.html

关于cocos2d-iphone - iads 与 cocos2d 的集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4127489/

相关文章:

objective-c - 我如何复制另一个Texture2D的一部分来创建自己的Texture2D

iOS 在 Viewcontroller 中正确结束 Cocos2D 游戏并重新启动问题

iphone - 更轻松地分配以增量方式创建的新变量

ios - 将 iOS uiviewcontroller 放到 cocos2d 层上

ios - 如何获得高质量的 iOS 屏幕截图?

ios - 带有自定义多边形的box2d崩溃

facebook - 呈现社交 View Controller Cocos2d

iphone - cocos2d位置坐标

iphone - 如何修复iPhone横向放大/缩小图像的大小?

ios - Instruments 实际报告什么?