Assuming:
pod 'Google/Analytics
, following the
official installation guide:
https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift
pod 'Google-Mobile-Ads-SDK', '~> 7.0'
, following the
official installation guide:
https://developers.google.com/admob/ios/quick-start#streamlined_using_cocoapods
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:
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
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'
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).
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)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With