IOS在接入 AdMob广告的时候根据https://developers.google.com/admob/ios/quick-start,的步骤进行,通过pod倒入sdk之后
通过下列方式初始化,注意不能按官方文档中的引入头文件,要通过下面
#import <GoogleMobileAds/GoogleMobileAds.h>
#import <GoogleMobileAds/GoogleMobileAds.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[GADMobileAds sharedInstance] startWithCompletionHandler:nil];
return YES;
}
@end
然后运行后回报错:
Undefined symbols for architecture x86_64:"_OBJC_CLASS_$_GADMobileAds", referenced from: objc-class-ref in AppController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
#import <GoogleMobileAds/GoogleMobileAds.h>
解决方案:
如果用CocoaPods导入的库,Build Setting->Linking->Other Linker Flags,添加$(inherited)