目标覆盖 `OTHER_SWIFT_FLAGS` 构建设置

Target overrides the `OTHER_SWIFT_FLAGS` build setting

这是我的 pod 文件:

platform :ios, '8.0'
use_frameworks!

target 'TestApp' do
  ...
end

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. 

如何解决这个问题?

  1. Select 你的项目

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

  3. 搜索 Other Swift Flags

  4. 现在您可能会看到 Other Swift Flags 的值显示在 BOLD

(BOLD 也意味着这个值正在被覆盖)

如终端中显示的警告:

Use the $(inherited) flag, or - Remove the build settings from the target.

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

选项 1:

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

选项 2:

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

我也有同样的问题,我必须使用多个目标和 cocoapods

  1. 分期/开发
  2. 生产

您可以在目标中添加多个 swift 标志 --> 构建设置 ---> 其他 Swift 标志。