问题描述
假设:
pod 'Google / Analytics
,遵循
官方安装指南:
pod'Google-Mobile-Ads-SDK','〜> 7.0'
,遵循
官方安装指南:
GoogleService -Info.plist
配置文件,使用此处报告的按钮指定Google Analytics和AdMob服务:
当我启动应用程序时,我收到警告:
然后,应用程序崩溃并显示以下错误:
$ b
其中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'
该应用不会崩溃不过,我收到警告:
这是我的完整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:
- I have configured CocoaPods for Google Analytics, using
pod 'Google/Analytics
, following theofficial installation guide:https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift - I have configured CocoaPods for AdMob, using
pod 'Google-Mobile-Ads-SDK', '~> 7.0'
, following theofficial installation guide:https://developers.google.com/admob/ios/quick-start#streamlined_using_cocoapods - I generated the
GoogleService-Info.plist
configuration file, specifying both Analytics and AdMob services, using the button reported here: https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift#get-config
When I start the app I get the warning:
Then the app crashes with the error:
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:
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问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!