Why am I getting the error ''FirebaseCore/FirebaseCore.h' file not found' when trying to run my iOS app

Viewed 4971

I recently started using a MacBook pro with the M1 chip from an older MacBook Pro which had no issues running this app. Now when I try to build and run my app I get the following issues:

'FirebaseCore/FirebaseCore.h' file not found

and

Could not build Objective-C module 'Firebase'

What I have tried:

  • cleaning my build folder
  • deleting derived data
  • restarting my computer
  • running pod install --repo-update
  • The error does go away when I change my Scheme to FirebaseCore, but then I am unable to run the app on a simulator.

Here is my pod file:

# Uncomment the next line to define a global platform for your project
 platform :ios, '14.0'

post_install do |pi|
    pi.pods_project.targets.each do |t|
      t.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
      end
    end
end

target 'Pikit' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Firebase
  pod 'Firebase'
  pod 'Firebase/Storage'
  pod 'Firebase/Auth'
  pod 'Firebase/Firestore'
  pod 'Firebase/Functions'
  pod 'Firebase/Analytics'
  pod 'Firebase/Messaging'
  pod 'Firebase/DynamicLinks'
  pod 'FirebaseUI/Auth'
  pod 'FirebaseUI/Email'
  pod 'FirebaseUI/Google'
  pod 'FirebaseUI/Facebook'
  pod 'FirebaseUI/OAuth' # Used for Sign in with Apple, Twitter, etc
  pod 'FirebaseUI/Phone'

  
  # Other Podfiles
  pod 'OnboardKit'
  pod 'SDWebImage'
  pod 'PureLayout'
  pod 'IQKeyboardManagerSwift'
  pod 'Google-Mobile-Ads-SDK'


  
end
5 Answers

If someone is still facing the problem, If you already cleaned the build folder, remove derived data, remove pod.lock and the pods folder what I suggest is to open the terminal and

insert : pod deintegrate && pod install

The difference is caused by the deintegrate call which will remove build phases as well as the framework folder.

To consider also : Using a M1 chip MacBook, what happened to me as well was getting the said error when building the project for a simulator and not a real device / macbook

"Build Active Architecture Only" plays a role in this. Try to change this setting and see if it helps.

Use pod update for Updating the Pod Use Cmd+sht+k for clean project and start building

Added this at the end of the podfile.

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

In my case I was running the .xcodeproj file and therefore my Pods weren't running concurrently. Use the .xcworkspace file to load project & Pods.

As a sidenote, if the above doesn't work & you're someone using Cordova & FirebaseX, the versions I used that worked to overcome issues were FirebaseX 8.0.1 & Cordova IOS 5.0.1*

* (For the time being, deprecation will soon come)

Related