SwiftUI Previews not working with Firebase

SwiftUI previews don't seem to work in Xcode 12, beta 5, when using Firebase Analytics. The app builds and runs fine to simulator or device, but fails generating SwiftUI preview for a widget with the following message:

Code Block
ld: in /Users/../.../Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_e321ed8e3db06efc9803f6c008e67a34.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/.../.../Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It was working fine in beta 4. Anyone else seen this? Any ideas?

16 Replies

I've seen quite a bit of weird behavior with frameworks, I think due to changes to the simulators to support Apple silicon. My temporary workaround is, in my app/extension targets, to add "arm64" to the Excluded Architectures build setting when building for the simulator (as your preview appears to be trying to do), and setting "Build Active Architecture Only" to No for all schemes. Might be worth a try.
This looks very much like a Xcode 12 bug. Did anybody already filed a bug in feedback assistant?
I figured out an alternative approach that I described here. Still finding its loopholes though.
try this:

Check if in your project for compiled target ->build settings -> user defined section (at the very bottom) you have defined VALID_ARCHS=arm64, if yes, delete it.
We are still seeing this exact error in Xcode 12 (12A7209) and this is not fixed yet. Is there a different workaround that won't kill our app for a considerable amount of devices?
excluding arm64 arch, doesn't allow to release build on devices(Iphone 6s, runing ios13.7). What should be the other approach or should i downgrade Xcode?
This is still happening in the latest Xcode 12 Beta 6. Will there be a fix soon as it is quite annoying having to add arm64 to the excluded architectures when I want to use previews?
Excluding arm64 worked great! Curious to see if this won't be necessary on an Apple Silicon machine...
Anybody found a solution to have both previews and device/simulator? It's a bit frustrating not to have both
Adding arm64 is work. thank you so much.
@tripletee, you saved the day ->week ->month!!

In the last year I work more on workarounds, Apple Bugs and changes instead of getting in my App solutions.
No fun anymore!


Thank you so much!!!
You are my heroes!

Though I can't get it to build on device with this set, it's nice to be able to at least use Previews (and simulator) when I'm working.
Adding arm64 to the excluded architectures build worked! Thanks guys. 👍🏻
Great, glad it worked. Caused several gray hairs to figure out. ;)