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?

Answered by tripletee in 628433022
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.
Accepted Answer
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.
34
Thank you! Adding arm64 to the excluded architectures build setting worked!
Great, glad it worked. Caused several gray hairs to figure out. ;)
Adding arm64 to the excluded architectures build worked! Thanks guys. 👍🏻
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.
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!


Adding arm64 is work. thank you so much.
Anybody found a solution to have both previews and device/simulator? It's a bit frustrating not to have both
Excluding arm64 worked great! Curious to see if this won't be necessary on an Apple Silicon machine...
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 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?
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?
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.
I figured out an alternative approach that I described here. Still finding its loopholes though.
SwiftUI Previews not working with Firebase
 
 
Q