首页 > 解决方案 > 无法修复“无法找到或使用自动链接库”

问题描述

我有一个使用 Swift 和 pods(firebase) 构建的应用程序。我有 18 个三角形和 100 个红色错误,这是以前没有的。它们仅在我尝试归档我的应用程序时出现。

我已经尝试了所有这些(添加搜索路径,添加空白 swift 文件,删除框架路径)

将 Swift 静态库与 Objective-C 项目一起使用时会出错

为什么链接器会链接带有错误的静态库?iOS

ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftsimd'
ld: warning: Could not find or use auto-linked library 'swiftGLKit'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftSpriteKit'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftModelIO'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftAVFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'

环境:Xcode 11 beta 4 / 目标:iOS 12 及以上

标签: iosswiftxcode

解决方案


苹果在已知问题部分提到了类似的问题:

包含 Swift 代码且 Enable Bitcode 构建设置设置为 Yes 的目标在使用 Archive 操作构建时无法正确链接。

并给我们一个解决方法:

添加一个名为 LD_VERIFY_BITCODE 的自定义构建设置,并将其设置为 NO。解决此问题后,请记下删除此自定义构建设置。


推荐阅读