【问题标题】:Using cocoaPods for google AdMob SDK使用 google AdMob SDK 的 cocoaPods
【发布时间】:2014-10-04 21:17:57
【问题描述】:

今天我试图将 GoogleAdMob SDK 更新到 6.12,因此在阅读文档时我发现 google 建议使用 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.

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

其次

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

在图片中,您可以看到所有框架都是红色的。那么这是一个问题还是它的罚款?

最后是我在使用 cocoaPods 之前运行的代码

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

我添加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)

【问题讨论】:

    标签: ios admob cocoapods


    【解决方案1】:

    你需要添加:

    $(inherited)
    

    在您的项目构建设置选项卡中OTHER_LDFLAGS

    【讨论】:

    • 好的。我会做的。其他问题呢?
    • 其他错误是链接器错误,因为您没有将库添加到链接器标志。一旦你添加了 $(inherited) 它应该构建
    • 好的。我会尝试并回复你
    • 这是否应该在再次运行pod install 时消除警告?
    • 是的,但是 $(inherited) 应该作为设置中的第一行添加
    【解决方案2】:

    您也可以这样做:

    - Remove the build settings from the target.
    

    通过其他链接器标志(@Andrei 上图)转到您的项目,然后按删除。它将删除您的设置,并从 pod 构建设置中写入继承的设置。

    如果您有其他标志,请不要这样做...

    @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:
    

    只需添加这一行

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

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

    【讨论】:

      猜你喜欢
      • 2017-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-14
      • 1970-01-01
      • 2020-01-15
      • 2017-01-08
      相关资源
      最近更新 更多