Reputation: 20412
Assuming:
pod 'Google/Analytics
, following the
official installation guide:
https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swiftpod 'Google-Mobile-Ads-SDK', '~> 7.0'
, following the
official installation guide:
https://developers.google.com/admob/ios/quick-start#streamlined_using_cocoapodsGoogleService-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-configWhen 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
Upvotes: 7
Views: 5367
Reputation: 951
Its easy to maintain using GoogleService-Info.plist file.
Just enable/disable services you want:
If you choosed you want to use some of them, then you need to specify them in your Podfile. Eg.
pod 'Google/CloudMessaging'
Full list of Google SDKs is available here.
Another way is to specify that you want to use Firebase. Just modufy your Podfile:
pod 'Firebase/Core'
Upvotes: 18
Reputation: 169
Have you tried to edit GoogleService-Info.plist and change "IS_ADS_ENABLED" to "NO"? If you are using "Google-Mobile-Ads-SDK" instead of "Google/AdMob" then your Ads should still work. "GoogleService-Info.plist" is not a requisite for AdMob (https://developers.google.com/admob/ios/quick-start#prerequisites).
Upvotes: 3
Reputation: 20412
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.
Upvotes: 1
Reputation: 21571
I had the same issue
Change
pod 'Google-Mobile-Ads-SDK', '~> 7.0'
to
pod 'Google/AdMob'
Only problem is pod 'Google/AdMob' is one release behind (7.6)
Upvotes: 1