Skip to content

Swift unit tests fail to find Firebase module #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paulb777 opened this issue May 18, 2017 · 35 comments
Closed

Swift unit tests fail to find Firebase module #16

paulb777 opened this issue May 18, 2017 · 35 comments

Comments

@paulb777
Copy link
Member

[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

@ryanwilson
Copy link
Member

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.

@ryanwilson
Copy link
Member

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.

@ryanwilson
Copy link
Member

ryanwilson commented Jun 2, 2017

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.

@JoGoFo-
Copy link

JoGoFo- commented Feb 9, 2018

As per #58 this issue is resolved with CocoaPods 1.4.0

@jacobDaurizio
Copy link

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!

@jacobDaurizio
Copy link

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

@flexaddicted
Copy link

flexaddicted commented Nov 19, 2018

I have the same error.

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

@jacobDaurizio
Copy link

How do I do that?

@paulb777
Copy link
Member Author

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.

@flexaddicted
Copy link

@paulb777 Thanks for the reply.

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

@jacobDaurizio
Copy link

Sorry I’m 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.

@morganchen12
Copy link
Contributor

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

@shtnkgm
Copy link

shtnkgm commented Dec 24, 2018

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

@nebiros
Copy link

nebiros commented Feb 12, 2019

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?

@andres-cianio
Copy link

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?

@LucaConfa
Copy link

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

@anonym24
Copy link

yes we should reopen this issue, still happens

@anonym24
Copy link

I have
image

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

Screenshot at Mar 31 19-14-52

@paulb777 paulb777 reopened this Mar 31, 2019
@anonym24
Copy link

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

@echamussy

This comment has been minimized.

@morganchen12
Copy link
Contributor

@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.

@rashdan

This comment has been minimized.

@ramunasjurgilas
Copy link

@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.

@paulb777
Copy link
Member Author

paulb777 commented Jul 8, 2019

@ramunasjurgilas See #16 (comment)

@MiZhen007
Copy link

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

@paulb777
Copy link
Member Author

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.

@ikeller96
Copy link

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

@paulb777
Copy link
Member Author

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

@ikeller96
Copy link

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

@ikeller96
Copy link

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

@morganchen12
Copy link
Contributor

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

@ikeller96
Copy link

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

@morganchen12
Copy link
Contributor

Can you share your project?

@ikeller96
Copy link

@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.

@mikezucc
Copy link

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"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests