Error: Could not build Objective-C module 'Firebase'

111,520

Solution 1

There is only one way to solve this issue.

  1. Quit Xcode.
  2. Delete project's temp files located at ~/Library/Developer/Xcode/DerivedData
  3. Delete ProjectName.xcworkspace
  4. Delete Podfile.lock file and Pods folder
  5. Run pod install.
  6. Open the newly created ProjectName.xcworkspace file and build.

Solution 2

Build ( + B) worked for me.

Solution 3

I am using Swift 4 and Xcode 9. All I have to do is selecting FirebaseCore Scheme.

On Xcode:

Product->Scheme->FirebaseCore.

If you don't have FirebaseCore go to Manage Schemes and select it. Then try again.

Solution 4

This may fix your problem:

  1. Quit the Xcode. (Don't just close the Xcode window, right click and Quit it explicitly).

  2. Go to ~/Library/Developer/Xcode/DerivedData and delete the project folder. (Simply delete all the folders).

  3. Clean and Build the project.

If still error exist:

Do steps 1 and 2 and follow this steps:

  1. Change scheme to Firebase and Build (Command + B).

  2. Change back to your app scheme and Run again.

Solution 5

I opened the project with .xcodeproj and I installed Firebase with cocoapods. I got the same error. But I just close the project and open it with .xcworkspace.

The alert has gone. Firebase was the first library on my project. So I kept using .xcodeproj file.

Share:
111,520
sebas.varela
Author by

sebas.varela

Updated on January 27, 2022

Comments

  • sebas.varela
    sebas.varela over 2 years

    When I compile the application I get an error equal to this:

    Could not build Objective-C module 'Firebase'

    This error appear in import Firebase of my file swift.

  • Cons Bulaquena
    Cons Bulaquena about 6 years
    If I delete ProjectName.xcworkspace, does it delete the previous code there?
  • Dimitris Bouzikas
    Dimitris Bouzikas about 6 years
    @ConsBulaquena Actually, you have to delete the xcworkspace, it doesn't include the code you wrote but is automatically generated by Pod, don't worry about it.
  • aremvee
    aremvee almost 6 years
    worked for me after I applied the first answer. Also had to change the FIRApp.configure() to FirebaseApp.configure()
  • Jonas
    Jonas almost 6 years
    I don't have a Xcode folder I ~/Library/Developer
  • Dimitris Bouzikas
    Dimitris Bouzikas almost 6 years
    @Jonas weird, open Xcode, go to Preferences->Locations and share what you see. Check mine: ibb.co/dUvgk8
  • Jonas
    Jonas almost 6 years
    @DimitrisBouzikas thanks a lot! It was under ~/User/ME/Library/... and there the Library folder was hidden. (Made it visible with Shift+cmd+(dot))
  • nommer
    nommer almost 6 years
    worked for me without having to apply Dimitris Bouzikas answer, and i was adding firebase to an existing project for those doing the same
  • Kaushal Topinkatti
    Kaushal Topinkatti almost 6 years
    Fantastic my friend you helped me, Thank You. Was searching for this from past 4 days. Thank You. Guys its works!!!
  • Mario Rojas
    Mario Rojas over 5 years
    I tried Dimitri's solution but it didnt work, ended up missing necessary files, this solution did fix the problem
  • Lucy
    Lucy over 5 years
    This worked for me too! (I also restarted Xcode using 'open myproject.xcworkspace after installing Pods in case that matters)
  • Dimitris Bouzikas
    Dimitris Bouzikas over 5 years
    @MarioRojas Can you determine what are the necessary files? Study a bit how Pod works.
  • Samarth Kejriwal
    Samarth Kejriwal over 5 years
    The above steps didnt solve my issue, please help me.
  • Admin
    Admin about 5 years
    solved my problem. Note that this will delete your existing build schemes.
  • Abhijith
    Abhijith about 5 years
    Please try other answers. Your case can be different.
  • Brent
    Brent almost 5 years
    This was the only answer that worked for me using Xcode 9.4 on Ionic 3 app.
  • Matthew Anderson
    Matthew Anderson almost 5 years
    When I switch my scheme back to my app scheme, this no longer works. Could someone please explain?
  • Ayrad
    Ayrad over 4 years
    the first two steps worked for me. I didn't have to delete the workspace file, I just had to open it instead of the project file after quitting xcode and deleting derived data
  • Julian Wagner
    Julian Wagner over 4 years
    for future readers, there is a library folder of the computer and one of the user, most of the time it is in the users one
  • Julian Wagner
    Julian Wagner over 4 years
    for those who don't know how to run pod install: stackoverflow.com/questions/30418062/…
  • Ruairí Oliver
    Ruairí Oliver almost 4 years
    I only needed step 4 and 5
  • shinriyo
    shinriyo almost 4 years
    Product => Edit Scheme... Short cut is command + <
  • ArdenDev
    ArdenDev over 3 years
    Thank YOU @marceh , this helped me. After trying the steps above it didn't work.
  • Milovan Tomašević
    Milovan Tomašević over 3 years
    Thanks a lot, you saved my time! xCode v12
  • Roman Soviak
    Roman Soviak over 3 years
    stackoverflow.com/a/28433526/7856586 if you cannot find DerivedData folder
  • cseh_17
    cseh_17 over 2 years
    This is the only solution that worked for me. Thanks!
  • Israr Ahmad
    Israr Ahmad over 2 years
    tried many other solutions. But this one worked. Really helped.
  • Mamedoff
    Mamedoff over 2 years
    Worked for me on my M1 Pro device. Thank you.
  • Genki
    Genki about 2 years
    I'd like to vote this as one of the funniest answers.
  • Qadir Hussain
    Qadir Hussain about 2 years
    this worked for me too. I disabled "Find implicit Dependencies" and build was working fine too, I recently got this issue after updating the xcode. Error gone by enabling this option again on the new updated xCode.