I recently installed CocoaPods and Firebase into my project. I've been attempting to build but am getting the following errors:
'FirebaseCore/FirebaseCore.h' file not found
Could not build Objective-C module 'Firebase'
- Command PhaseScriptExecution failed with a nonzero exit code
I checked my folders and the FirebaseCore.h file definitely does NOT exist. I've reinstalled CocoaPods, modified the Podfile and did a 'pod update' and 'pod install' several times.
I've reviewed several of the questions and solutions listed on stack overflow but none of them have worked.
Here are my specs:
Xcode 11.3.1
Swift 5
My Podfile looks like this:
# platform :ios, '9.0'
target 'project' do
use_frameworks!
# Pods for Project
pod 'MessageKit', '~> 3.0.0-swift5'
pod 'MessageInputBar'
# Add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
# Add the pods for any other Firebase products you want to use in your app
# For example, to use Firebase Authentication and Cloud Firestore
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
end
-
Note that you don't need Firebase/Core any longer as it's included in Analytics.Jay– Jay2020年01月14日 17:32:03 +00:00Commented Jan 14, 2020 at 17:32
3 Answers 3
That's the error you'll get when opening the project using the .xcodeproj file.
You need to use the .xcworkspace file to open the project.
That file is generated when installing the pods using cocoapods.
Other things to try
Quit XCode. Go into terminal and do this
sudo gem install cocoapods. Then use the cocoapods.app to update the project with your pod file. Then clean and rebuild the project.In your project, select the project name in the left column (where the project files are). Then in Targets, ensure the Team popup is selected to your team name, not 'None' and that your Signing Certificate is correct.
This one is extreme but I have seen it correct some build issues. Deleting the login keychain (using the keychain.app). This will also delete all of your stored passwords so keep that in mind.
6 Comments
Even I had same issue when upgrading to Xcode 11.2.1. Errors were resolved after using Firebase 6.13.0. Please make changes to your Podfile as below,
pod 'Firebase', '=6.13.0'
pod 'Firebase/Core'
pod 'Firebase/Analytics'
3 Comments
Somehow my base project had other issues that were generating this error that I was never able to uncover. So I did the following:
1. Created a new project and imported old project files.
2. Installed cocoapods on the new project
3. Followed the FireBase instructions referenced in the answer from @Jay
4. Cleaned project and performed a build
5. No more error