【iOS 開發(fā)】解決使用 CocoaPods 執(zhí)行 pod install 時出現(xiàn) - Use the `$(inherited)` flag ... 警告

CocoaPods

公司項目在執(zhí)行 pod install 的時候總是出現(xiàn)很多黃色的警告,因為是警告并不會影響項目的正常編譯,一直沒有在意,但是總是有很多警告看起來很不舒服,于是就花了點時間解決掉了,下面將解決方法記錄下來分享給有同樣問題的你們。


警告信息

產(chǎn)生此警告的原因是項目 Target 中的一些設置,CocoaPods 也做了默認的設置,如果兩個設置結(jié)果不一致,就會造成問題,顯示的警告信息如下:

[!] 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 以后,再把之前的設置加進去,否則編譯可能會出現(xiàn)很多報錯。

  • 然后重新執(zhí)行 pod install 或者 pod update 就會發(fā)現(xiàn)警告消失了。

  • 如果我的方法不能夠解決你的問題的話,可以試一下網(wǎng)上的另一種方法,就是點擊項目文件 project.xcodeproj ,右鍵顯示包內(nèi)容,用文本編輯器打開 project.pbxproj ,command + F 搜索 OTHER_LDFLAGS ,刪除搜索到的設置,command + S 保存,然后重新執(zhí)行 pod install 或者 pod update


方法就是這樣,希望我的方法能夠解決你的問題。

將來的你,一定會感激現(xiàn)在拼命的自己,愿自己與讀者的開發(fā)之路無限美好。

我的傳送門: 博客簡書 、微博 、GitHub 。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容