Firebase-ios-sdk: Swift unit tests fail to find Firebase module

Created on 18 May 2017  路  35Comments  路  Source: firebase/firebase-ios-sdk

[REQUIRED] Step 2: Describe your environment

  • Xcode version: 8.3
  • Firebase SDK version: 4.0
  • Library version: 4.0
  • Firebase Product: all (auth, database, storage, core, messaging, etc)

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

Unit tests for Swift projects that import Firebase fail to build
Details in http://stackoverflow.com/questions/38216090/xcode-unit-testing-with-cocoapods/39602648
Reproducible test case at https://github.com/marcelofabri/BrokenFirebase

core

Most helpful comment

This is still happening. Confirmed with CocoaPods 1.6.0. @shtnkgm workaround works. There's a way to set up this search path from the Podfile?

All 35 comments

It looks like ${PODS_ROOT}/Firebase/Core/Sources is appropriately being added to the regular target's .xcconfig file but not the test .xcconfig file. Trying to figure out if this is on our side, or if I can find issue in Cocoapods.

In the meantime for people seeing this issue, adding ${PODS_ROOT}/Firebase/Core/Sources to the HEADER_SEARCH_PATHS after $(inherited) in your Pods-<ProjectName>Tests.debug.xcconfig should fix the build.

Still investigating.

Workaround:

  • Add "${PODS_ROOT}/Firebase/Core/Sources" to your Tests target only under Build Settings -> Header Search Paths

The root cause has to do with our internal build system and I'll track the progress at #58.

As per #58 this issue is resolved with CocoaPods 1.4.0

I've had this problem and I found by running _sudo gem update_ in terminal and then adding _pod 'Firebase'_ to the podfile, I was bale to solve it. Hope this turns out the same for you. Good luck!

Actually never mind the problem is back. Are you using Xcode 10?

I have the same error.

I fixed using $(SRCROOT)/Pods/Firebase/Core/Sources in the Header Search Path for my test target only.

How do I do that?

Some possible workarounds:

  • Use CocoaPods 1.6.0
  • Switch to the Xcode Legacy build system
  • Add "${PODS_ROOT}/Firebase/CoreOnly/Sources" to the Tests target only under Build Settings -> Header Search Paths

If someone shares a reproducible example, I'll take a deeper look.

@paulb777 Thanks for the reply.

For some strange reason, using ${PODS_ROOT} does not resolve correctly.

Sorry I鈥檓 really new to this. Could you tell me like a step by step like what things to press and where to type in Xcode for the ${PODS_ROOT} things? Your help is greatly appreciated.

It's one of the fields in the Build Settings tab of your xcodeproj file.

I solved this problem by adding the following settings to the Header Search Path in the test target.

  • ${SRCROOT}/Pods/Firebase/CoreOnly/Sources

2018-12-24 17 15 03

This is still happening. Confirmed with CocoaPods 1.6.0. @shtnkgm workaround works. There's a way to set up this search path from the Podfile?

Being the top search result probably makes this the best place to ask, eventhough the issue is closed.
@ryanwilson Issue is still happening. Should we stick to the mentioned workaround?

Same here, issue still happening on CocoaPods 1.6.0.
Confirming that @shtnkgm workaround was good for me!

yes we should reopen this issue, still happens

I have
image

But still I have this issue Missing required module 'Firebase'

Screenshot at Mar 31 19-14-52

I had to use this temporary solution https://stackoverflow.com/a/40524145/7767664 to fix it

This is still an issue using cocoapods 1.6.2. The above workarounds have not helped me, it complains about the following Undefined Symbols:

UploadCam___SchoolCam_Work_Package_-_Google_Docs_and_TutorialCatalogTests_swift

@echamussy this is a separate issue from the parent issue. The above issue is resolved with just fixing the header search paths; yours is one where you're missing symbols at link time. Please file a new issue and share a project that reproduces your error.

+1

@morganchen12 For me it is still not clear how this could be fixed. Could you please explain how header search paths should be fixed.

I tried several suggestion, but they were not helping.

I just wanna figure out whose bug it is, firebase? or cocoapods?

I tested the reproducible test case above with Xcode 10.1 and CocoaPods 1.7.5 and it successfully finds the Firebase module.

We'll need an example that is reproducible with current tools to make more progress.

Wait so was there a fix? Still happening for me as well.

@ikeller96 There was a CocoaPods fix in 1.6.0. If it's still happening for you, we need a repro to investigate.

@paulb777 I am on CocoaPods version 1.5.3. I'll try updating and see if that works.

So @paulb777 I have CocoaPods v 1.6.0 now but I am getting the same error in a different test.

Have you tried deleting derived data since installing a new version of CocoaPods?

@morganchen12 Yes. Just tried that and I'm still getting the same error.

Can you share your project?

@morganchen12 This problem was occurring for me during an attempt at a swift 5 migration. Our company has decided to rebuild the app and therefore there will be no more releases so we are no longer going to try the swift 5 migration. Thank you for your help though.

Reposting an above reply from anonym24 for the weary traveler:
"I had to use this temporary solution https://stackoverflow.com/a/40524145/7767664 to fix it"

Was this page helpful?
0 / 5 - 0 ratings