因为我将Firebase添加到我的项目Live中,所以它不再工作了。常规的构建是可行的,只是没有现场预览。
我尝试跟踪所有这些answer解决方案和注释,但都没有结果(这个问题有相同的错误,尽管与SwiftUI无关)。
诊断:
退出代码1的链接器命令失败(使用-v查看调用)
LinkDylibError:未能构建UserViews.swift
链接失败:退出代码1的链接器命令失败(使用-v查看调用)
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(FIRAppAssociationRegistration.o)
___llvm_profile_runtime_user in FirebaseCore(FIRComponentType.o)
___llvm_profile_runtime_user in FirebaseCore(FIRConfiguration.o)
___llvm_profile_runtime_user in FirebaseCore(FIRCoreDiagnosticsConnector.o)
___llvm_profile_runtime_user in FirebaseCore(FIRDiagnosticsData.o)
___llvm_profile_runtime_user in FirebaseCore(FirebaseCore-dummy.o)
___llvm_profile_runtime_user in FirebaseCore(FIROptions.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)发布于 2020-05-06 16:05:21
现在,我不得不暂时禁用Firebase (和GoogleSignIn)来使用。
在我的例子中,我使用Cocoapods,因此我注释掉了Podfile中的库:
# pod 'Firebase/Analytics'
# pod 'Firebase/Crashlytics'
# pod 'Firebase/Messaging'
# pod 'GoogleSignIn'然后$ pod install暂时删除它们。
最后,在需要的地方使用#if canImport(Firebase) (和#if canImport(GoogleSignIn))预处理宏。
#if canImport(Firebase)
import Firebase
#endif
#if canImport(GoogleSignIn)
import GoogleSignIn
#endif
// ...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
// ...
#if canImport(Firebase)
FirebaseApp.configure()
#endif这并不是最优的,但在Xcode 12修复它或Google更新其框架之前,没有别的办法。
发布于 2020-06-13 04:23:52
尝试禁用方案的代码覆盖率。
这对我有用。
On Xcode 11.3通过简单地禁用为我的方案收集的代码覆盖率,我已经能够构建SwiftUI预览。上面的解决方案不起作用,因为我仍然收到了Firebase的"failedToBuildDylib“错误。事实上,至少在我的情况下,上面的修正似乎根本没有必要。希望这能帮上忙。
发布于 2020-10-05 14:08:42
使用SPM安装firebase (使用beta分支,因为到目前为止它仍然是测试版),并删除CocoPods。预览将再次完美地运行。
下面是通过SPM https://github.com/firebase/firebase-ios-sdk/blob/master/SwiftPackageManager.md安装防火墙的链接
https://stackoverflow.com/questions/60440074
复制相似问题