解決 ld: library not found for -lPods的問題

最近計劃把公司的項目重構一下,第一步就是引入CocoaPods(以下簡稱pods)來管理第三方庫。但是這第一步就不是太順利。
首先建好Podfile,并在命令行中輸入pod install,結果報以下錯誤

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

現在打開有pods建好的workspace文件,嘗試編譯,會報ld: library not found for -lPods錯誤,原因就是工程里面的設置項覆蓋了pods中xcconfig中的設置。解決辦法就是在build setting->other linker flag中,加上$(inherited)即可。

OK,重新安裝pod試試,由于我們已經進行過一次安裝,所以本次只用更新一次即可,在命令行中輸入pod update,現在沒有報任何錯誤。但是當我嘗試編譯工程的時候,又報了一個錯誤:ld: library not found for -lReactiveCocoa。咋又找不到相應的第三方庫了呢?好吧,繼續查資料。

最后還是在cocoapods的官網Troubleshooting找到的解決辦法。在Edit Scheme中,找到Build項,點擊+號,找到Pods靜態庫,點擊Add。再嘗試編譯,編譯通過。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容