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

7

9

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
Telephone answered 22/6, 2021 at 14:34 Comment(5)
Duplicate of #52077502?Neill
The linked question deals with a newly created pod file, I believe my issue stems from the new Apple M1 chip. I have been able to run this project with no issues on other operating systems. Also the selected answer to this question was to update from xcode 8 to xcode 9 while I am using xcode 12 @PaulBeusterienTelephone
Why don't you just find out whether or not your project contains a file named FirebaseCore.h?Eloisaeloise
What happens if you run Xcode using Rosetta? (Find Xcode.app in Finder go to Get Info and select Open using Rosetta). You'll need to do a Clean Build Folder before you try and run/build. I created a project with same podfile and it doesn't run when using Xcode without Rosetta (but not same error as your post) but because the GoogleSignIn SDK doesn't support M1 yet and FirebaseUI/Google pod depends on this.Yawmeter
Telling us what version of cocoa pods is installed (pod --version) and what version of Firebase you have would help us. Deintegrating the pods and then re-doing that may help but lets take a look at the versions first.Bullshit
J
10

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.

UPDATE:

All the firebase dependencies are supposed to run on M1 simulators.

For general knowledge though:

If some dependency is failing you on a M1 Macbook, arm64 simulator, find the 'libName'.xcframework of the wanted dependency, and make sure it contains a 'ios-arm64_x86_64-simulator' folder, then drag and drop it at the your project root (copy or reference as you prefer).

If the dependency fails to be found whilst building:

open you Project in the project navigator => Find your Target in the Targets column => General dongle => scroll to Framework, Libraries and Embbeded Content and embed your libary which was in a "Do not Embed" status.

The best way to do so is through Carthage.

Nice to know : If the wanted dependency doesn't contain the required folder, it's still possible to ask the devs directly on Github.

Jasisa answered 21/9, 2021 at 8:24 Comment(2)
Hi Ruben, Did you build it for a simulator now? I don't have an iPhone :( Do you have a trick to make it work?Marteena
@JesualdoFloresAlvarado. Look at the edit I have made. It might interest you.Jasisa
T
3

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
Trochee answered 14/11, 2021 at 0:14 Comment(0)
T
3

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)

Tiflis answered 15/2, 2022 at 1:45 Comment(1)
Me doing same thing lmao xDTeethe
U
2

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

Univalve answered 27/9, 2021 at 20:32 Comment(0)
E
1

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

Ewald answered 22/6, 2021 at 20:29 Comment(3)
As stated in my question I have already tried thisTelephone
Try to uninstall and install the app againEwald
Let's try to install pod with specified version numberEwald
O
0

Please do the following.

  1. rm -rf ~/Library/Developer/Xcode/DerivedData/
  2. pod deintegrate
  3. pod install
Overcapitalize answered 9/6, 2023 at 8:34 Comment(0)
C
0

Did you just run an old project on a new download of macOS, Xcode, etc...? That's when this problem can occur due to changes in Google Firebase as compared to "updates" in Xcode and macOS and iOS.

The quick answer: Modern Firebase packages don't require you to import FirebaseCore in your Podfile, it sorta just comes with it. However, instead of pulling your hair out trying to comment-out import statements and trying to figure out how that will work, there's a better way.

Easiest & best way to get rid of this problem is to switch from using CocoaPods dependency manager to using Swift Package Manager (SPM). That might not sound appealing to long-time CocoaPods users (like me) who learned a whole lingo, but SPM is actually rather simple to use for well-trodden dependencies like Google's Firebase.

First, use the "pod deintegrate" command to un-install CocoaPods from your project. Instead of re-installing it, now go to Google's Firebase page on setting up Firebase, and go to the section on using SPM instead of CocoaPods. It's really simple and requires simply opening a menu in Xcode and picking which packages you want from Firebase. Here's the directions: https://firebase.google.com/docs/ios/installation-methods#swift-package-manager

Open the File menu on Xcode-> select Add Packages

enter image description here

then insert the URL/website link provided in Firebase documentation into the the search bar on the upper right:

enter image description here

After you press "Add Package" you'll be given a list of packages from Firebase you can add to your project. Either add the ones that show up in your import statements in your files, or open you Podfile from your project folder using Terminal ("open Podfile") and read what you wrote previously and find them.

THE ONLY ONE YOU WON'T FIND IS "FirebaseCore" (old way of writing it is Firebase/Core), and that's because it comes as part of ANY Firebase package. In fact, if you look in your Pods for your project, you'll find FirebaseCore is one of the files.

You will probably have more problems than this, but mostly after this it will just be going thru your projects errors and inserting the given solutions by Xcode.

Crux answered 19/8, 2023 at 22:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.