【问题标题】:SwiftUI canvas preview compile error: Undefined symbols for architecture x86_64SwiftUI 画布预览编译错误:架构 x86_64 的未定义符号
【发布时间】:2020-01-12 15:01:17
【问题描述】:

我有一个项目,我正在使用 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)

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

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

【问题讨论】:

    标签: xcode swiftui


    【解决方案1】:

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

    https://twitter.com/dannypier/status/1190312160557068293

    【讨论】:

    • 感谢您的回答。它帮助我解决了预览问题
    • 这有帮助。但是我们为什么要这样做呢?看起来像 Xcode 中的一个错误。
    • 一百万个点指向您,您必须通过点击才能找到它。非常感谢。
    【解决方案2】:

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

    答案在:CocoaPods Issue

    【讨论】:

    【解决方案3】:

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

    【讨论】:

    • 我遇到了同样的问题,您的解决方案对我有用。谢谢
    猜你喜欢
    • 2017-03-03
    • 1970-01-01
    • 2022-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-24
    相关资源
    最近更新 更多