将cocoaPods用于google AdMob SDK

Ran*_*jit 15 admob ios cocoapods

今天我尝试将GoogleAdMob SDK更新为6.12.因此,在阅读文档时,我发现谷歌建议使用cocoaPods来管理依赖项.我从之前的6.10 SDK文件中删除了我的项目,并执行如下操作.

所以我在我的机器上安装了cocoaPods,并按照adMob文档中给出的步骤进行操作

安装pod后,我从终端收到此消息

Installing Google-Mobile-Ads-SDK (6.12.0)
Generating Pods project
Integrating client project

[!] From now on use `abc.xcworkspace`.

[!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile:

    source 'https://github.com/CocoaPods/Specs.git'


[!] The `abc [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `abc [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
Run Code Online (Sandbox Code Playgroud)

我的第一个怀疑 这些警告意味着什么以及如何解决这个问题?

其次

我按照cocoaPods的建议打开了abc.xcworkspace,我现在可以看到两个项目如下面的屏幕截图

在此输入图像描述

在图像中,您可以看到所有框架都是红色的.这是一个问题还是罚款?

最后我的代码在使用cocoaPods之前工作

m_googleAdView.frame = CGRectMake(0.0, 918.0, kGADAdSizeBanner.size.width,kGADAdSizeBanner.size.height);
[m_googleAdView loadRequest:[GADRequest request]];
Run Code Online (Sandbox Code Playgroud)

我添加bannerView的代码已编码,但我现在收到这些错误

Undefined symbols for architecture armv7:
  "_kGADAdSizeBanner", referenced from:
      -[AllViewController viewDidLoad] in AllViewController.o
  "_OBJC_CLASS_$_GADRequest", referenced from:
      objc-class-ref in AllViewController.o
      objc-class-ref in PageViewController.o     
  "_OBJC_CLASS_$_GADBannerView", referenced from:
      objc-class-ref in AllViewController.o
      objc-class-ref in PageViewController.o      
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

小智 54

你需要添加:

$(inherited)
Run Code Online (Sandbox Code Playgroud)

OTHER_LDFLAGS在项目建设设置选项卡

在此输入图像描述


Lig*_*Man 9

作为替代方案,您可以这样做:

- Remove the build settings from the target.
Run Code Online (Sandbox Code Playgroud)

转到你的项目,通过Other Linker标志(@ Andrei的上图)并按删除.它将删除您的设置,从pods构建设置中写入继承的设置.

如果你有额外的旗帜,不要这样做......

@Ranjit:对于这个问题:

[!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile:
Run Code Online (Sandbox Code Playgroud)

只需添加此行即可

source 'https://github.com/CocoaPods/Specs.git'
Run Code Online (Sandbox Code Playgroud)

在podfile的顶部,正如它所说的......