更新google广告时报错
下载地址
http://dl.google.com/googleadmobadssdk/googleadmobadssdkios.zip
解压后发现相比之前用的sdk多了几个头文件,将相关代码拷贝到原来sdk目录下进行覆盖。
clear后build,报错。
(1)错误1
Undefined symbols for architecture armv7:
"CGSizeFromGADAdSize(GADAdSize)", referenced from:
-[iFarmerAppDelegate buildADmobADView] in iFarmerAppDelegate.o
-[iFarmerAppDelegate setAdViewPostion:withY:] in iFarmerAppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
查询相关代码,发现此处报错是因为之前版本与最新版本中的GAD_SIZE相关预定义值发生了变化,之前版本中GAD_SIZE的定义是放在GADBannerView.h中:
// iPhone and iPod Touch ad size.
#define GAD_SIZE_320x50 CGSizeMake(320, 50)
下载地址
http://dl.google.com/googleadmobadssdk/googleadmobadssdkios.zip
解压后发现相比之前用的sdk多了几个头文件,将相关代码拷贝到原来sdk目录下进行覆盖。
clear后build,报错。
(1)错误1
Undefined symbols for architecture armv7:
"CGSizeFromGADAdSize(GADAdSize)", referenced from:
-[iFarmerAppDelegate buildADmobADView] in iFarmerAppDelegate.o
-[iFarmerAppDelegate setAdViewPostion:withY:] in iFarmerAppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
查询相关代码,发现此处报错是因为之前版本与最新版本中的GAD_SIZE相关预定义值发生了变化,之前版本中GAD_SIZE的定义是放在GADBannerView.h中:
// iPhone and iPod Touch ad size.
#define GAD_SIZE_320x50 CGSizeMake(320, 50)
// Medium Rectangle size for the iPad (especially in a UISplitView's left pane).
#define GAD_SIZE_300x250 CGSizeMake(300, 250)
// Full Banner size for the iPad (especially in a UIPopoverController or in
// UIModalPresentationFormSheet).
#define GAD_SIZE_468x60 CGSizeMake(468, 60)
// Leaderboard size for the iPad.
#define GAD_SIZE_728x90 CGSizeMake(728, 90)
而最新版本中增加了一个GADAdSize.h,所有的 GAD_SIZE的定义放到了该头文件中,且内容和之前的也不一样:
#define GAD_SIZE_320x50 CGSizeFromGADAdSize(kGADAdSizeBanner)
#define GAD_SIZE_300x250 CGSizeFromGADAdSize(kGADAdSizeMediumRectangle)
#define GAD_SIZE_468x60 CGSizeFromGADAdSize(kGADAdSizeFullBanner)
#define GAD_SIZE_728x90 CGSizeFromGADAdSize(kGADAdSizeLeaderboard)
#define GAD_SIZE_120x600 CGSizeFromGADAdSize(kGADAdSizeSkyscraper)
因此,最简单的修改方式就是将使用预定义变量的地方直接替换为原来版本中其对应文本即可