ios - 将 cocoaPods 用于谷歌 AdMob SDK

标签 ios admob 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.

我的第一个疑问 这些警告是什么意思,如何解决?

其次

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

enter image description here

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

最后是我的代码,它在使用 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)

最佳答案

你需要添加:

$(inherited)

到项目build设置选项卡中的 OTHER_LDFLAGS

enter image description here

关于ios - 将 cocoaPods 用于谷歌 AdMob SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26101768/

相关文章:

ios - 是否有 Opencv 的 podspec?

ios - 尝试在 swift 项目中使用 cocoa pod 安装 Purelayout

ios - 访问自定义推送通知负载

ios - Parse IAP 与 StoreKit 相比安全性如何

android - 与 Admob 和 Webview 重叠

android - AdMob 错误 "you must have adactivity declared in androidmanifest.xml with configchanges"

ios - 您的规范源都不包含满足依赖项 : Firebase (~> 6. 33.0)、Firebase (= 6.33.0, ~> 6.33.0) 的规范

iOS 发布更新

ios - 将数据添加到另一个 NSDictionary 中的 NSDictionary

ios - 广告标识符(IDFA)? -Admob