Christopher Wade Cantley Christopher Wade Cantley - 5 months ago 75
Swift Question

Google/Analytics.h file not found when Testing

I am including the BridgingHeader.h however on importing Google/Analytics.h it can't find the file.

This works fine in the application, it only throws the error under testing.

Not sure what the issue is so any insight would be greatly appreciated.

enter image description here

Answer

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' do
pod 'Google/Analytics'
end

target 'MyAppTests' do
pod 'Google/Analytics'
end

target 'MyAppUITests' do
pod 'Google/Analytics'
end

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

Comments