一旦更新到 Xcode 12,就会出现几个警告:
模块“RxSwift”没有使用库进化支持进行编译;使用它意味着无法保证“app”的二进制兼容性
您收到这些警告的原因是 PodBUILD_LIBRARY_FOR_DISTRIBUTION在其构建设置中缺少该标志。
将以下post_install脚本添加到您的 podfile 并确保它位于您的target 'app' do块之外:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
Run Code Online (Sandbox Code Playgroud)
查看以下问题了解更多详细信息: https://github.com/CocoaPods/CocoaPods/issues/9232
我不会轻视这个警告。请参阅 swift 论坛上的以下讨论: https://forums.swift.org/t/risks-of-compiler-warning-module-was-not-compiled-with-library-evolution-support/33941