最近計(jì)劃把公司的項(xiàng)目重構(gòu)一下,第一步就是引入CocoaPods(以下簡(jiǎn)稱pods)來(lái)管理第三方庫(kù)曹仗。但是這第一步就不是太順利。
首先建好Podfile,并在命令行中輸入pod install
货邓,結(jié)果報(bào)以下錯(cuò)誤
[!] 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.
現(xiàn)在打開(kāi)有pods建好的workspace文件,嘗試編譯四濒,會(huì)報(bào)ld: library not found for -lPods
錯(cuò)誤换况,原因就是工程里面的設(shè)置項(xiàng)覆蓋了pods中xcconfig中的設(shè)置职辨。解決辦法就是在build setting->other linker flag中,加上$(inherited)即可戈二。
OK舒裤,重新安裝pod試試,由于我們已經(jīng)進(jìn)行過(guò)一次安裝觉吭,所以本次只用更新一次即可腾供,在命令行中輸入pod update
,現(xiàn)在沒(méi)有報(bào)任何錯(cuò)誤亏栈。但是當(dāng)我嘗試編譯工程的時(shí)候台腥,又報(bào)了一個(gè)錯(cuò)誤:ld: library not found for -lReactiveCocoa
。咋又找不到相應(yīng)的第三方庫(kù)了呢绒北?好吧黎侈,繼續(xù)查資料。
最后還是在cocoapods的官網(wǎng)Troubleshooting找到的解決辦法闷游。在Edit Scheme中峻汉,找到Build項(xiàng),點(diǎn)擊+號(hào)脐往,找到Pods靜態(tài)庫(kù)休吠,點(diǎn)擊Add。再嘗試編譯业簿,編譯通過(guò)瘤礁。