FirebaseApp.configure() crashes for unit test target

Ok so this turned out to be caused by an incorrectly-configured Pod file. My main target and unit test target were configured to use the following pods:

pod 'Crashlytics', '~> 3.10.1'
pod 'Fabric', '~> 1.7.6'
pod 'Firebase/Core', '~> 4.8'
pod 'FirebaseRemoteConfig', '~> 2.1'

Removing the additional Firebase pods for the test target ONLY (other than Firebase/Core) and running pod install again helped.

I'm not altogether sure why this worked, so would be very grateful if someone could explain this to me.

The "${PODS_ROOT}/Fabric/run" build phase script was configured on my primary target as detailed in Google's docs here: https://firebase.google.com/docs/crashlytics/get-started, and adding it to the test target didn't help either...

Thanks to everyone for their input, but adding the Fabric details manually to the Info.plist file just caused a build error. I believe this step is automatically handled for Firebase.


We had the same crash when running XCTest. We use the following to get around it.

        if NSClassFromString("XCTest") != nil {
            return true
        } else {
            FirebaseApp.configure()
        }