Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

ios - 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From the instructions at https://github.com/firebase/firebase-ios-sdk/blob/master/AppleSilicon.md:

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...