简体   繁体   English

将cocoaPods用于google AdMob SDK

[英]Using cocoaPods for google AdMob SDK

Today I was trying to update GoogleAdMob SDK to 6.12, So while reading documentation I found that google recommends to use cocoaPods to manage dependencies .I deleted by previous 6.10 SDK files from my project and did as below. 今天我尝试将GoogleAdMob SDK更新为6.12。因此,在阅读文档时,我发现谷歌建议使用cocoaPods来管理依赖项 。我从之前的6.10 SDK文件中删除了我的项目,并执行如下操作。

So I installed cocoaPods on my machine, and followed the steps given in the adMob docs 所以我在我的机器上安装了cocoaPods,并按照adMob文档中给出的步骤进行操作

After installing the pod, I got this message from terminal 安装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.

My first doubt What does these warning means and how to resolve this? 我的第一个怀疑这些警告意味着什么以及如何解决这个问题?

Secondly 其次

I opened abc.xcworkspace as suggested by cocoaPods, I could see two projects now as screen shot below 我按照cocoaPods的建议打开了abc.xcworkspace,我现在可以看到两个项目如下面的屏幕截图

在此输入图像描述

Here in the image you can see all frameworks are in red. 在图像中,您可以看到所有框架都是红色的。 So is that an issue or its fine? 这是一个问题还是罚款?

Lastly my code which was working before using cocoaPods 最后我的代码在使用cocoaPods之前工作

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

My code for adding bannerView is already coded, But I get these errors now 我添加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)

You need to add: 你需要添加:

$(inherited)

to OTHER_LDFLAGS in your projects build settings tab 到项目构建设置选项卡中的OTHER_LDFLAGS

在此输入图像描述

As an alternative you can do this: 作为替代方案,您可以这样做:

- Remove the build settings from the target.

Go to your project, over Other Linker flags (@Andrei's picture above) and press delete. 转到你的项目,通过Other Linker标志 (@ Andrei的上图)并按删除。 It will delete your settings a write the inherited ones from the pods build settings. 它将删除您的设置,从pods构建设置中写入继承的设置。

Do not do this if you have additional flags... 如果你有额外的旗帜,不要这样做......

@Ranjit: For this issue: @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:

Just add this line 只需添加此行即可

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

At the top of your podfile, as it says ... 在podfile的顶部,正如它所说的......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM