Google/Analytics.h file not found when Testing Google/Analytics.h file not found when Testing swift swift

Google/Analytics.h file not found when Testing


I had a similar issue and fixed it by adding the Google Analytics pod to both the tests and uitests targets by opening up your podfile and modifying it as shown:

target 'MyApp' dopod 'Google/Analytics'endtarget 'MyAppTests' dopod 'Google/Analytics'endtarget 'MyAppUITests' dopod 'Google/Analytics'end

Once that was complete I had to run pod install twice and then it worked.


Spent near 2 hours on searching and finally found correct solution to all that madness! Accepted solution above is working, but gives a lot of Class GAIUtil is implemented in both... warnings which is not quite right that means.

Solution

You need to use cocoapods 1.0.0.beta6+

Your test target should be defined in your Podfile as next:

target 'App' do    pod 'GoogleAnalytics' , '~> 3.0'    # your other pods    target 'AppTests' do        inherit! :search_paths        # your other testing pods/frameworks    endend

Do pod update.

All that found there https://github.com/CocoaPods/CocoaPods/issues/4626#issuecomment-210402349