Target会覆盖`OTHER_SWIFT_FLAGS`构建设置

con*_*ile 31 xcode ios cocoapods

这是我的pod文件:

platform :ios, '8.0'
use_frameworks!

target 'TestApp' do
  ...
end
Run Code Online (Sandbox Code Playgroud)

之后pod install我收到以下错误:

[!] The `TestApp [Debug]` target overrides the `OTHER_SWIFT_FLAGS` build setting defined in `Pods/Target Support Files/Pods-TestApp/Pods-TestApp.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `TestApp [Release]` target overrides the `OTHER_SWIFT_FLAGS` build setting defined in `Pods/Target Support Files/Pods-TestApp/Pods-TestApp.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target. 
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

Zig*_*ong 66

  1. 选择您的项目

  2. 切换到项目Build Settings面板.

  3. 搜索 Other Swift Flags

  4. 现在您可以Other Swift FlagsBOLD中看到节目的价值

(BOLD也表示该值被覆盖)

在此输入图像描述

正如终端中显示的警告:

使用$(inherited)标志,或 - 从目标中删除构建设置.

您可以通过以下两种方式使编译器满意:

选项1:

双击Other Swift Flags值区域并将值替换为$(inherited)

选项2:

选择Other Swift Flags面板使其突出显示.然后按键盘上的删除按钮,现在字体将变为THIN,而不是BOLD.

  • 好吧,我会说这解决了这个特定的警告,但是如果(现已删除的)swift标志_已经被使用了,可能会产生许多其他问题.只是盲目地删除它们并不是处理这种情况的常用方法.如果用于条件编译的那些值(如DEBUG或RELEASE)则可以将此值移动到"活动编译条件"构建设置. (3认同)
  • 也适用于``ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES``设置. (2认同)
  • 第三个选项是添加 $(inherited) 标志作为附加标志,而不是替换(如果您需要维护现有的自定义标志), (2认同)