我正在尝试将 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/