问题
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.
回答1:
There is only one way to solve this issue.
- Quit Xcode.
- Delete project's temp files located at
~/Library/Developer/Xcode/DerivedData - Delete
ProjectName.xcworkspace - Delete
Podfile.lockfile andPodsfolder - Run
pod install. - Open the newly created
ProjectName.xcworkspacefile and build.
回答2:
Build (⌘ + B) worked for me.
回答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.
回答4:
This may fix your problem:
Quit the Xcode. (Don't just close the Xcode window, right click and Quit it explicitly).
Go to
~/Library/Developer/Xcode/DerivedDataand delete the project folder. (Simply delete all the folders).Clean and Build the project.
If still error exist:
Do steps 1 and 2 and follow this steps:
Change scheme to Firebase and Build (Command + B).
Change back to your app scheme and Run again.
回答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.
回答6:
Install FireBase properly via CocoaPods. Try the following steps
Step 1 - Close Xcode
Step 2 - Clear your derived data. You can find your derived data in here
~/Library/Developer/Xcode/DerivedData Step 3 - Open your .xcworkspace
Step 4 - Clean your project (⌘+Shift+K)
Step 5 - Build your project (⌘+B)
Make sure your are opened .xcworkspace file
回答7:
'pod deintegrate' and then 'pod install' worked for me.
回答8:
Can you please try to take a look at my answer here
TL;DR make sure you are running cocoapods version 1.4.0 minimum. It fixes static framework imports.
You can do this by running sudo gem install cocoapods on your terminal and verify your version by typing pod --version
回答9:
I tried this (quitting Xcode, deleting all temp files, reinstalling pods, etc.) and it didn't work. What did work was just building my project (command + b) after pod install. Whatever works!
回答10:
I am using Swift 4 and Xcode 9.4. This helped solve the same issue for me.
I selected the following frameworks in XCode -> Manage Schemes besides my target project
In Xcode:
Product-> Scheme-> FirebaseCore
Product -> Scheme -> nanopb
Product -> Scheme -> GoogleToolBoxforMac
回答11:
This worked for me:
- Close Xcode
- pod deintegrate
- delete xcworkspace
- pod install
- In project Navigator > project name > Configurations
- Set all to none
- Clean
- Build
回答12:
This happened to me today, I just couldn't figure out why, because when I closed the file that night, everything was perfect. I opened my file using the recent projects menu and got this issue. Then I decided to check something, Xcode opened the wrong file. Instead of opening the workspace file with the pods, it opened the Xcode project.
Once I opened the workspace it was error free and all the pods were behaving. Im sure you guys are all more experienced than me, but I just wanted to throw that in there.
回答13:
just restart your xcode and run your project.
回答14:
Nothing here worked for me, but then I figured out something that did work.
When I clicked on my project in Project Navigator in Xcode, and then selected Info I looked at the Configurations section and saw that there was only a Release configuration and no Debug configuration for my app.
In order to get Firebase to work, I went to Pods within the Project Navigator, and under the Configurations section I deleted the Debug configuration. Now it builds fine. Hopefully this will help someone else.
回答15:
Tried the above suggestions, but they didn't work for me. What worked for me was to build to Generic iOS Device first and then run it on my physical device iPhone6.
I still couldn't run it on a simulator, however. What worked here was to change Build Active Architecture Only - Debug to NO, in the Pod Project Build Settings.
Hope this helps someone.
回答16:
Make sure you are working with the workspace file created in the same directory as the pod file.
回答17:
After 2 days of searching and trying every single step proposed in this post, eventually i could solve the problem. None of the above approaches solved my problem but this one:
- There is a package of Firebase frameworks available to download from this link: https://firebase.google.com/download/ios?authuser=0
- There is a Firebase.h header file in this package. I added this header file to my project resources.
- Finally i added a line of code at the top of this file: ' #import "Firebase.h" '
Simply and Easily the error is gone!
回答18:
I had disabled Find Implicit Dependencies for faster build process under Edit Scheme... > Build.
Enabling it back resolved the issue.
回答19:
I had the exact same issue
You could be reinstalling pods with your Xcode open Or your pods file won't allow and overwrite
With your workspace open, delete the "Pods" folder. Quit X-Code Open terminal in "Utilities" You'll find this in "Applications" Using cd ... go to your project folder reinstall pods using "pod install".
That should fix it.
来源:https://stackoverflow.com/questions/41709912/error-could-not-build-objective-c-module-firebase