Hi,
I can't seem to be able to run any tests due to various problems. I've searched and roamed through the vast number of forums online but nothing helped me so far. This, this or this. All of them have some pointers but none of them seem to help.
My Podfile is:
platform :ios, '10.0'
use_frameworks!
inhibit_all_warnings!
target "URLRemote" do
pod 'Alamofire', '~> 4.0'
pod 'MBProgressHUD', '~> 1.0'
pod 'Bond', '~> 5.0'
pod 'Fabric'
pod 'Crashlytics'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'FirebaseAnalytics'
pod 'Material', '~> 2.0'
pod 'Motion', '~> 1.0'
pod 'ObjectMapper', '~> 2.0'
target "URLRemoteTests" do
inherit! :search_paths
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'FirebaseAnalytics'
pod 'OHHTTPStubs'
pod 'OHHTTPStubs/Swift'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
end
And the errors I'm getting are:
'FirebaseAnalytics/FirebaseAnalytics.h file not found'
and
'Could not build Objective-C module Firebase'
Any ideas what could be wrong? The project itself runs well, but the tests don't.
What version of CocoaPods are you using? If you manually add $(PODS_ROOT)/FirebaseAnalytics/Frameworks/frameworks (or whatever the correct path is) to your test target's framework search paths, does the error go away? If so, it may be an issue in CocoaPods with inherit! search_paths.
The version of CocoaPods I am using is 1.2.0.
The error doesn't go away if I manually add it to the field Header Search Paths:

I've tried it with quotes, without quotes, with curly brackets and normal brackets, recursive and non-recursive. Each time project clean + build. The error did not go away.
I'm not sure how inherit! :search_paths could be broken. I've also tried inherit :complete without any luck - getting the same problem.
OK, so a little update. I did reset up the Header Search Paths and set the inherit! :complete and now it finally works. No idea why it has to be this way - I suppose because Firebase code is pulled from private repos, unlike other OSS frameworks.
inherit! :complete is the solution. I used inherit! search_paths before and the change to :complete did it. Note: If you are using other frameworks that require an Objective-C bridging header, you might also need to copy the Build Setting for the bridging header over to your test target. In my case the test build target did not contain the bridging header setting (should not be required for Firebase).
HEADER_SEARCH_PATHS = ${PODS_ROOT}/Firebase/Core/Sources in my Pods-unitTests.debug.xcconfig did the trick.
Most helpful comment
inherit! :completeis the solution. I usedinherit! search_pathsbefore and the change to:completedid it. Note: If you are using other frameworks that require an Objective-C bridging header, you might also need to copy the Build Setting for the bridging header over to your test target. In my case the test build target did not contain the bridging header setting (should not be required for Firebase).