firebase tag.**CocoaPods** | Carthage | Zip file (select one)Can't render SwiftUI canvas due to FirebaseCore
linker command failed with exit code 1 (use -v to see invocation)
----------------------------------------
LinkDylibError: Failed to build TemplateListView.swift
Linking failed: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator'
Undefined symbols for architecture x86_64:
"___llvm_profile_runtime", referenced from:
___llvm_profile_runtime_user in FirebaseCore(FIRComponentType.o)
___llvm_profile_runtime_user in FirebaseCore(FIRConfiguration.o)
___llvm_profile_runtime_user in FirebaseCore(FIRDiagnosticsData.o)
___llvm_profile_runtime_user in FirebaseCore(FirebaseCore-dummy.o)
___llvm_profile_runtime_user in FirebaseCore(FIRAnalyticsConfiguration.o)
___llvm_profile_runtime_user in FirebaseCore(FIRBundleUtil.o)
___llvm_profile_runtime_user in FirebaseCore(FIRAppAssociationRegistration.o)
...
(maybe you meant: ___llvm_profile_runtime_user)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Rendering SwiftUI Canvas. The current workaround is to disable code coverage in the build scheme
NA
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
A reproducible example would help us to diagnose
Any SwiftUI examples seems to reproduce the issue. Here are some SO posts regarding the issue:
https://stackoverflow.com/questions/60440074/problems-with-firebase-and-swiftui-live-previews
This workaround worked my project:
https://stackoverflow.com/a/62355502/699002
which references this tweet:
https://twitter.com/dannypier/status/1190312160557068293
I suspect that solving #2022 may resolve this. Until then, the workarounds may be the best bet.
Also may be related this issue noted at https://forums.swift.org/t/swift-packages-in-multiple-targets-results-in-this-will-result-in-duplication-of-library-code-errors/34892/38:
There is an entirely separate issue which happens only for Xcode previews which is related to all package products being built dynamically in Xcode 12 to enable previews. It is also something we're actively investigating. There is no workaround for this, since users do not have control over how builds for preview are being done.
Does Xcode 12 beta 5 make any difference?
Unfortunately it does not Xcode 12 beta 5 does not fix the issue.
I was able to reproduce this issue and the workaround works for me as well.
Steps to reproduce:
cd into the directory, run pod init.pod 'FirebaseCore' to the Podfile.pod update..xcworkspace generated from CocoaPods.ContentView.swift, add import FirebaseCore and replace the contents of body with:var body: some View {
Text("Hello, world!")
.padding()
.onAppear {
// Use some arbitrary calls from `FirebaseCore`
if let defaultApp = FirebaseApp.app() {
print("Firebase configured! \(defaultApp.name)")
} else {
print("Firebase not configured.")
}
}
}
@brandtdaniels hope you don't mind that I changed the title to make it easier to find for folks, and more accurately state the issue. Thanks again for the report.
TODO: Attempt to reproduce with Firebase 7, since dynamic frameworks are now used. Also check with Xcode 12.2 release candidate to see if the Xcode issue is resolved with static frameworks.
Any updates on this?
Same for me. Still an issue
This is still an issue, it's most likely an Apple bug as I have found a few related issues on their forum, with weird workarounds(remove arm64 which was already done, validate workspace, set Build Active Architecture Only" to No and other such. Nothing worked or made sense for me and my project, and going through this thread I tried disabling the code coverage capability for my main scheme - and weirdly enough, that made the previews render.
Most helpful comment
@brandtdaniels hope you don't mind that I changed the title to make it easier to find for folks, and more accurately state the issue. Thanks again for the report.