iOS: CocoaPods issue with Google Analytics and AdMob

Viewed 5287

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
4 Answers
Related