Unter der Annahme:iOS: CocoaPods Problem mit Google Analytics und AdMob
- Ich habe konfiguriert CocoaPods für Google Analytics, mit
pod 'Google/Analytics
nach dem offiziellen Installationsanleitung: https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift - Ich habe CocoaPods konfiguriert AdMob, mit
pod 'Google-Mobile-Ads-SDK', '~> 7.0'
, nach der offiziellen Installationsanleitung: https://developers.google.com/admob/ios/quick-start#streamlined_using_cocoapods - I erzeugt die
GoogleService-Info.plist
Konfigurationsdatei, die beide Analytics und AdMob Dienste spezifizieren, indem Sie die Taste hier berichtet: https://developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift#get-config
Wenn ich die app starten erhalte ich die Warnung:
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.
Dann ist die App stürzt mit dem Fehler ab:
was von der Assert-Zeile ausgelöst wird, von diesem Code der Google An alytics Dokumentation, die in der AppDelegate.swift
Datei hinzufügen:
// Configure tracker from GoogleService-Info.plist.
var configureError:NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring Google services: \(configureError)")
Ich habe versucht, ich
ersetzenpod 'Google-Mobile-Ads-SDK', '~> 7.0'
mit pod 'Google/AdMob'
Die App nicht mehr funktioniert abstürzen, aber ich erhalte die Warnung:
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
Das ist mein voller 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
passiert, wenn Sie das Mobile Ads SDK auch selbst importieren? –
@Chauduyphanvu, es ist ein CocoaPod-Problem, also hat es mit der CocoaPod-Version zu tun –