SwiftUI 画布预览编译错误:体系结构 x86_64 的未定义符号

Kev*_*ers 8 xcode swiftui

我有一个使用 Firebase 的 Firestore 和 Auth 的项目。当我创建 SwiftUI 视图时,预览画布不起作用。我收到以下错误。

Compiling failed: linker command failed with exit code 1 (use -v to see invocation)

failedToBuildDylib: ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator'
Undefined symbols for architecture x86_64:
  "___asan_alloca_poison", referenced from:
      +[GDTFLLUploader gzippedData:] in GoogleDataTransportCCTSupport(GDTFLLUploader.o)
  "___asan_allocas_unpoison", referenced from:
      +[GDTFLLUploader gzippedData:] in GoogleDataTransportCCTSupport(GDTFLLUploader.o)
  "___asan_handle_no_return", referenced from:
      -[FIRAuthCredential init] in FirebaseAuth(FIRAuthCredential.o)
      -[FIRAuthCredential prepareVerifyAssertionRequest:] in FirebaseAuth(FIRAuthCredential.o)
      -[FIREmailAuthProvider init] in FirebaseAuth(FIREmailAuthProvider.o)
      -[FIRCollectionReference initWithQuery:] in FirebaseFirestore(FIRCollectionReference.o)
Run Code Online (Sandbox Code Playgroud)

即使在最基本的“Hello World”视图中也会发生这种情况,我不导入与 Firebase 相关的任何内容。

我可以对此做些什么,或者我可以在整个项目中不使用预览画布吗?

小智 16

您可以通过取消选中Code Coverage选项在此处找到解决方案

https://twitter.com/dannypier/status/1190312160557068293 在此处输入图片说明

  • 这有帮助。但我们为什么要这样做呢?看起来像是 Xcode 中的一个错误。 (6认同)
  • 这很荒谬,但效果很好 (2认同)

小智 7

这对我有用:禁用该方案的代码覆盖率。

答案位于:CocoaPods 问题


Kev*_*ers 5

我设法通过从方案的诊断选项中取消选中“地址清理程序”选项来修复它。