【iOS 开发】解决使用 CocoaPods 执行 pod install 时出现 - Use the `$(inherited)` flag ... 警告

CocoaPods

公司项目在执行 pod install 的时候总是出现很多黄色的警告,因为是警告并不会影响项目的正常编译,一直没有在意,但是总是有很多警告看起来很不舒服,于是就花了点时间解决掉了,下面将解决方法记录下来分享给有同样问题的你们。


警告信息

产生此警告的原因是项目 Target 中的一些设置,CocoaPods 也做了默认的设置,如果两个设置结果不一致,就会造成问题,显示的警告信息如下:

[!] The `client_ios_fm_a [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-client_ios_fm_a/Pods-client_ios_fm_a.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
  
[!] The `client_ios_fm_a [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-client_ios_fm_a/Pods-client_ios_fm_a.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
  
[!] The `client_ios_fm_a [Debug]` target overrides the `OTHER_CFLAGS` build setting defined in `Pods/Target Support Files/Pods-client_ios_fm_a/Pods-client_ios_fm_a.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
  
[!] The `client_ios_fm_a [Debug]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-client_ios_fm_a/Pods-client_ios_fm_a.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
  
[!] The `client_ios_fm_a [Release]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-client_ios_fm_a/Pods-client_ios_fm_a.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
  
[!] The `client_ios_fm_a [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-client_ios_fm_a/Pods-client_ios_fm_a.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
  
[!] The `client_ios_fm_a [Release]` target overrides the `OTHER_CFLAGS` build setting defined in `Pods/Target Support Files/Pods-client_ios_fm_a/Pods-client_ios_fm_a.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
  
[!] The `client_ios_fm_a [Release]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-client_ios_fm_a/Pods-client_ios_fm_a.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
警告信息

解决方法

  • 打开项目 Target - Build Settings ,搜索 Other Linker Flags ,在这个设置上加入 $(inherited)

  • 打开项目 Target - Build Settings,依次搜索如下图所示的警告上提示的设置名称,将这些设置选项全部改为 $(inherited) ,或者选中这些设置按下 delete 键恢复原设置。

设置名称
  • 如果有 FRAMEWORK_SEARCH_PATHS 这个设置的警告的话,最好先把当前的设置项记录下来,然后选中设置按下 delete 以后,再把之前的设置加进去,否则编译可能会出现很多报错。

  • 然后重新执行 pod install 或者 pod update 就会发现警告消失了。

  • 如果我的方法不能够解决你的问题的话,可以试一下网上的另一种方法,就是点击项目文件 project.xcodeproj ,右键显示包内容,用文本编辑器打开 project.pbxprojcommand + F 搜索 OTHER_LDFLAGS ,删除搜索到的设置,command + S 保存,然后重新执行 pod install 或者 pod update


方法就是这样,希望我的方法能够解决你的问题。

将来的你,一定会感激现在拼命的自己,愿自己与读者的开发之路无限美好。

我的传送门: 博客简书微博GitHub

推荐阅读更多精彩内容

  • 项目组件化、平台化是技术公司的共同目标,越来越多的技术公司推崇使用pod管理第三方库以及私有组件,一方面使项目架构...
    swu_luo阅读 14,246评论 0 36
  • 人从出生伊始,就展开了与时间的赛跑,总是必须不断努力地追赶光阴的脚步,探索未知的旅程。生活对于我们来说是什么?是一...
    鹤鸣川阅读 34评论 0 0
  • 一位诗友写了一首诗 送给我和阿哩,还有他自己 题目叫 《一个三十岁男诗人的爱情》 看了一遍 确实是他说的那么回事 ...
    吻章阅读 129评论 0 0
  • 今天在区党委中心彩排诗歌朗诵,明天为党庆生。九十六年前,沉睡的雄狮苏醒,九十六年前的他们聚会才有了今日我们的团聚。...
    傻傻的天真的羊阅读 45评论 0 0
  • 前几天做了一道HITCON2017的web题目,与朋友交流之后,有了一点思路,奈何最后还是没有成功解出这题。在wr...
    jessica1123阅读 532评论 0 1