Transfer to Apple M1 Xcode shows an error "'FirebaseCore/FirebaseCore.h' file not found" and "Could not build Objective-C module 'Firebase'"
Asked Answered
O

4

2

There is a fairly common problem in my Xcode project. I'm using Firebase and project perfectly works with Xcode 11 on Intel i5, but with Xcode 13 (Swift 5) on Apple M1 there are 2 dramatic errors:

  • 'FirebaseCore/FirebaseCore.h' file not found

'FirebaseCore/FirebaseCore.h' file not found

  • Could not build Objective-C module 'Firebase'Could not build Objective-C module 'Firebase'

My Pods:

enter image description here

So, what I tried:

  1. Quite xcode Delete "ProjectName.xcworkspace", "Podfile.lock" and "Pods". Delete project's temp files located at ~/Library/Developer/Xcode/DerivedData (Command + Shift + G in finder) Run "pod install" from terminal. Open "ProjectName.xcworkspace".

Error: Could not build Objective-C module 'Firebase' with Swift 5

  1. Adding arm64 to Excluded Architectures for the main project AND for the Pods project

enter image description here

enter image description here

Xcode 12: build Error on FIRAnalyticsConnector

And many other options. But neither one is suitable for me. What should I try?

Oatis answered 12/11, 2021 at 15:27 Comment(2)
Try pod deintegrate and pod updatePyroxene
@PaulBeusterien thanx, but doesn't work. How do you think, is it possible that this problem exists because I used Migration Assistant for new macbook M1?Oatis
H
0
  1. $ pod deintegrate
  2. $ pod clean
  3. open the terminal with using Rosetta
  4. $ pod install
Humes answered 19/11, 2021 at 10:0 Comment(2)
How do you "open the terminal with Rosetta"?Benildis
You may need to use the Terminal prefix arch -x86_64 before these commans, such as "-x86_64 pod deintegrate". Also, it looks like 'clean' is no longer a pod command.Benildis
P
3

My friend tried this. Add this to the end of the podfile and re-install your pods. Took me and the team hours, but we eventually figured this out.

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end
Peria answered 14/11, 2021 at 0:17 Comment(2)
thanx, tell me please how correctly re-install cocoapods with M1?Oatis
@StanislavPutilov There are many ways to do this the way I'm doing is: 1. Delete .workspace file. 2. Delete Pods folder. 3. Delete podfile.lock and run pod installPeria
K
2

We were running into a similar build error using XCode 15 when building for the Simulator on Mac M1/M2s:

Library 'FirebaseCore' not found

This was our setup

  • XCode 15.0.1
  • Firebase/Core (8.8.0) (see Podfile.lock)

Building for connected devices would compile and deploy OK.

That version of the Firebase library does not yet provide an XCFramework that supports running on both x86_64 and arm64 architectures and can lead to this and other build faiulures.

So in order to build and deploy to Simulators we needed to ensure that Xcode would show the Rosetta Simulator Destinations.

This can be done by using the following Xcode menu:

  • Product / Destination / Destination Architectures / Show Rosetta Destinations

Then choosing a Rosetta simulator and building again allowed us to deploy to the Simulator destinations.

Note that earlier versions of Xcode provided an "Open using Rosetta" open in Finder, but this option was removed in Xcode 14.3

Show Rosetta Destinations

Keever answered 23/11, 2023 at 16:37 Comment(1)
Save my day, searching for 2 days got final solution , thanks @KeeverSoprano
L
1

I had the same issue when transferring Xcode to M1 pro Mac. Though, none of the answers above was not working for me, I found out that my googleService.info plist was, for some reason, never transferred to the new Mac. I download it from firebase console and it started to work. Hoping this might be help someone.

Lashing answered 28/2, 2022 at 19:26 Comment(0)
H
0
  1. $ pod deintegrate
  2. $ pod clean
  3. open the terminal with using Rosetta
  4. $ pod install
Humes answered 19/11, 2021 at 10:0 Comment(2)
How do you "open the terminal with Rosetta"?Benildis
You may need to use the Terminal prefix arch -x86_64 before these commans, such as "-x86_64 pod deintegrate". Also, it looks like 'clean' is no longer a pod command.Benildis

© 2022 - 2024 — McMap. All rights reserved.