我在我的項目中集成了admob。添加了所有框架,其他鏈接器標誌和調解ID。iOS中的Admob集成錯誤
我創建bannerview代碼:
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;
}
這個時候沒有任何錯誤。問題是什麼。請告訴我。
你想出解決方案的說明? –
不,我仍然遇到同樣的問題。 –
你有沒有想出解決方案@HariBabu?我面臨同樣的錯誤,我嘗試了很多方法,但沒有運氣。 –