gpt4 book ai didi

ios - iOS 中的 Admob 集成错误( undefined symbol )

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:06:58 25 4
gpt4 key购买 nike

我在我的项目中集成了 admob。添加了所有框架、其他链接器标志和中介 ID。

我创建横幅 View 的代码是:

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
CGPoint origin = CGPointMake(self.window.frame.size.height/2 - CGSizeFromGADAdSize(kGADAdSizeBanner).width/2 , 0.0);
self.m_pBannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin];
self.m_pBannerView.adUnitID = ADMOM_ID_IPHONE;
} else {
CGPoint origin = CGPointMake(0.0,self.window.frame.size.height -CGSizeFromGADAdSize(kGADAdSizeLeaderboard).height);
self.m_pBannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeFromCGSize(CGSizeMake(768, 90)) origin:origin];
self.m_pBannerView.adUnitID = ADMOB_ID_IPAD;

}

self.m_pBannerView.delegate = self;
[self.m_pBannerView setRootViewController:navController_];
[navController_.view addSubview:self.m_pBannerView];
GADRequest * request = [GADRequest request];
[self.m_pBannerView loadRequest:request];
[navController_.view bringSubviewToFront:self.m_pBannerView];

我收到以下错误:

Undefined symbols for architecture i386:
"CGSizeFromGADAdSize(GADAdSize)", referenced from:
-[AppController createBannerAd] in AppDelegate.o
"GADAdSizeFromCGSize(CGSize)", referenced from:
-[AppController createBannerAd] in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

但相同的代码在另一个项目中工作。现在我的项目有 Box2d 和 Cocos2d。

我尝试了以下代码:

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
CGPoint origin = CGPointMake(self.window.frame.size.height/2 - CGSizeFromGADAdSize(kGADAdSizeBanner).width/2 , 0.0);
self.m_pBannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin];
self.m_pBannerView.adUnitID = ADMOM_ID_IPHONE;
} else {
CGPoint origin = CGPointMake(0.0,self.window.frame.size.height -CGSizeFromGADAdSize(kGADAdSizeLeaderboard).height);
self.m_pBannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeFromCGSize(CGSizeMake(768, 90)) origin:origin];
self.m_pBannerView.adUnitID = ADMOB_ID_IPAD;

}

这次没有错误。

最佳答案

Change the GAD_ ad sizes with:
kGADAdSizeBanner.size.width and kGADAdSizeBanner.size.height

检查这个

Admob integration issue

关于ios - iOS 中的 Admob 集成错误( undefined symbol ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21304412/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com