老項(xiàng)目使用 CocoaPods 遇到的 install 問題

Android 目前開發(fā)中常使用 Gradle 管理依賴,久聞 iOS 使用 CocoaPods 管理依賴。

使用 CocoaPods 方便使用第三庫時的管理、更新、配置。

因老項(xiàng)目使用 SDWebImage 加載和緩存圖片,但是是直接將源代碼復(fù)制進(jìn)項(xiàng)目的做法,今天在修改代碼時,想一步一步將項(xiàng)目的第三方庫通過 CocoaPods 來管理依賴。

#Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'

target 'demo' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for demo
  pod 'SDWebImage', '~>3.8'

  target 'demoTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

執(zhí)行 pod install 時,遇到了如下錯誤:

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

......

開始以為這只是普通警告而已,選擇了無視;導(dǎo)入 #import <SDWebImage/UIImageView+WebCache.h> Xcode 也能正確跳轉(zhuǎn)到對應(yīng)代碼,但編譯會報該文件 not found;

網(wǎng)上搜索一番,找到CocoaPods報錯問題,照著操作,

但很神奇,一確認(rèn)參數(shù)就不見了,再點(diǎn)開參數(shù)又在里面,不管了,將文章中對應(yīng)的三處都修改,執(zhí)行 install,還是報一樣的錯誤 ??????

又搜索一番,找到CocoaPods 錯誤 target overrides the OTHER_LDFLAGS...,照著操作,pod install 執(zhí)行成功,但 Xcode 編譯報其它文件 not found ??????

終端提示明明是

- Use the `$(inherited)` flag, or

而且網(wǎng)上很多問題也是加此代碼,很費(fèi)解 ??????

關(guān)鍵來了,解決辦法

PROJECT
TARGETS

原來在 Xcode7 有兩處 Build Settings,需要在 TARGETS 下的 Build Settings 修改才生效;

install 完,將項(xiàng)目的里的 SDWebImage 源代碼刪除,運(yùn)行成功??

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

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

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