开发者

iads integration with cocos2d

I am trying to integrate iads in my cocos2d application. In the ABCPopAppDelegate file implemnentation I have the following code:

- (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 ,开发者_JAVA百科 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];

And I get the following error:

"_OBJC_CLASS_$_ADBannerView", referenced from:

what does that mean?


You are getting that error because you haven't add the iADFramework to your Target on XCode. Make sure you add it as a WEAK reference so that it doesn't break on devices running < 4.0 iOS. Don't forget to make the RootViewController to comply with ADBannerViewDelegate.

As the above are suggesting, I would also recommend you to go through a nice tutorial. I like this one:

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

and this other one:

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜