iOS:Google Analytics和AdMob出现CocoaPods问题 [英] iOS: CocoaPods issue with Google Analytics and AdMob

查看:1400
本文介绍了iOS:Google Analytics和AdMob出现CocoaPods问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设:



当我启动应用程序时,我收到警告:


您已在Developer Console中启用AdMob服务,但其
好​​像您的Podfile缺少该行:'pod
Google / AdMob,或者您可能需要运行 pod update 在您的项目
目录中。


然后,应用程序崩溃并显示以下错误:
$ b


声明失败:配置Google服务时出错:可选(错误
Domain = com.google.greenhouse代码= -106缺少预期的子类。
UserInfo = {NSLocalizedFailureReason =某些子类不是安装pod
。查看日志以了解详细信息,NSLocalizedDescription = Missing
expected subspecs。)):file /myapp/AppDelegate.swift

其中Google Analytics文档中提到的 c $ c> AppDelegate.swift 文件中添加了此代码的断言行:

  //从GoogleService-Info.plist中配置跟踪器。 
var configureError:NSError?
GGLContext.sharedInstance()。configureWithError(& configureError)
assert(configureError == nil,配置Google服务时出错:\(configureError))





我尝试将



pod'Google-Mobile-Ads-SDK','〜> 7.0' with pod'Google / AdMob'



该应用不会崩溃不过,我收到警告:


您目前正在使用SDK 7.6.0版本。请考虑
将您的SDK更新到最新的SDK版本,以获得最新的
功能并修复错误。





这是我的完整Podfile:

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

平台:ios,'8.0'
use_frameworks! #使用Swift时需要


target'myProject'do

pod'Google / Analytics'
pod'GoogleIDFASupport'
pod' Google-Mobile-Ads-SDK','〜> 7.0'

pod'Fabric'
pod'Crashlytics'

pod'SQLite.swift','〜> 0.9.2'

end


解决方案

我决定在 GoogleService-Info.plist 配置文件支持的 Google / AdMob 中使用pod行,因为它似乎是管理多种Google服务的最一致的方式。

唯一的问题是,它目前的更新周期较慢:AdMob窗格仍有版本7.6而不是最新的7.7。不过,我仍然喜欢这种方式。无论如何,它应该经常更新。


Assuming:

When I start the app I get the warning:

You have enabled the AdMob service in Developer Console, but it appears as though your Podfile is missing the line: 'pod "Google/AdMob" or you may need to run pod update in your project directory.

Then the app crashes with the error:

assertion failed: Error configuring Google services: Optional(Error Domain=com.google.greenhouse Code=-106 "Missing expected subspecs." UserInfo={NSLocalizedFailureReason=Some subspecs are not pod installed. See log for details., NSLocalizedDescription=Missing expected subspecs.}): file /myapp/AppDelegate.swift

which is thrown by the assert line, of this code the Google Analytics documentation said to add in the AppDelegate.swift file:

// Configure tracker from GoogleService-Info.plist.
var configureError:NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring Google services: \(configureError)")



I tried to I replace

pod 'Google-Mobile-Ads-SDK', '~> 7.0' with pod 'Google/AdMob'

The app doesn't crash anymore, but I get the warning:

You are currently using version 7.6.0 of the SDK. Please consider updating your SDK to the most recent SDK version to get the latest features and bug fixes


This is my full Podfile:

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

platform :ios, '8.0'
use_frameworks!  # needed when using Swift


target 'myProject' do

    pod 'Google/Analytics'
    pod 'GoogleIDFASupport'
    pod 'Google-Mobile-Ads-SDK', '~> 7.0'

    pod 'Fabric'
    pod 'Crashlytics'

    pod 'SQLite.swift', '~> 0.9.2'    

end

解决方案

I decided to use the pod line with Google/AdMob, supported by the GoogleService-Info.plist configuration file, as it seems the most consistent way to manage multiple Google services.

The only problem is that it currently has a slower update cycle: the AdMob pod there is still at version 7.6 instead of the latest 7.7. However I still prefer that way. It should get updated pretty often anyway.

这篇关于iOS:Google Analytics和AdMob出现CocoaPods问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆