iosxcodecocoapodsfirebase-analyticssdwebimage

Firebase analytics and other modules on Apple M1 chip


I'm using the Firebase and the SDWebImageSwiftUI module in my SwiftUI 2 app with Xcode 12.3 and Cocoapod 1.10.0 on my Apple M1 MacBook Pro.

As long as I don't integrate the Firebase Analytics module via Cocoapod the app works fine but when I integrate it, I get the same error as the guy here: Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64. His solution also works for me (exclude arm64 architecture for the project and pods).

However now the SDWebImageSwiftUI module (included via swift package manager) is complaining "Could not find module 'SDWebImageSwiftUI' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator". If I include the module via Cocoapod then the compiler says "No such module "SDWebImageSwiftUI".

Does anyone of you has an idea on what I could do?

Any help is much appreciated


Solution

  • Edit March 2023 - Since Firebase 7.5.0, Firebase supports the M1 processor by default. No special instructions are needed.

    When specifying which version of Firebase you'd like in your Podfile, append -M1 to the version. See the following examples:

    Explicitly require the special M1 tagged Firebase version, locked to the exact version. Note that due to the version scheme, you're required to update this manually for each release otherwise you will revert to the official release (ex. 7.2.0 instead of 7.2.0-M1).

    pod 'Firebase/Analytics', '7.2-M1'

    Do the same for any other Firebase pod used.

    pod 'Firebase/Database', '7.2-M1'

    Remember: now you need to manually add -ObjC to avoid a runtime crash. This CocoaPods issue has been fixed in CocoaPods/CocoaPods#10234 and is merged for the upcoming CocoaPods 1.10.1 patch release.