I am having much trouble integrating Google Analytics SDK into my iOS project. I am using XCode 7 and targeting iOS 7. Using Swift 2.0. However I can get the sample working ok (not converting to Swift 2.0 though).
I've tried both install via CocoaPods and by copying the files manually from:
https://developers.google.com/analytics/devguides/collection/ios/v3/sdk-download
When installing via CocoaPods I've tried both
pod 'Google/Analytics'
,
pod 'GoogleAnalytics'
and
pod 'Google/Analytics', '~> 1.0.0'
Either case the XCode build fails with error
BridgingHeader.h:2:9: 'Google/Analytics.h' file not found
Failed to import bridging header '/Users/jonas.andersson/Projects/MyAppName/MyAppName/Supporting files/BridgingHeader.h'
This on row:
#import <Google/Analytics.h>
I've also tried to add
$(SRCROOT)/Pods/GoogleAnalytics
and the rest of the suggestions from Google/Analytics.h file not found when adding to AppDelegate
Update
Using pod 'GoogleAnalytics'
and then #import <Google/Analytics.h>
worked better. However then I get the following error:
Use of unresolved identifier 'GGLContext'
when I try setup GA from according to Google documentation:
var configureError:NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
Solved it by going away from Googles own tutorial and not use
GGLContext
and importing headers directly.My podfile:
And
BridgingHeader.h
:And setup:
Also added to
User Header Search Paths
:Instead of:
This what worked for me, XCODE9.0.