iOS 項目組件化踩坑指南

1. 新生成組件私有庫添加依賴庫執(zhí)行pod install報錯

原因: 導(dǎo)入的庫是先前創(chuàng)建的私有庫,沒發(fā)布在GitHub上。但是CocoaPods默認(rèn)會從master索引庫(會在GitHub上搜索這個第三方庫)找這個組件,才會報找不到這個私有組件。


解決辦法: 只需在Podfile文件指定這個組件的遠(yuǎn)程索引庫地址就行。記得把CocoaPods的索引庫地址也加上不然安裝CocoaPods上的第三方會報錯找不到文件。

leon:Example huanghaipo$ pod install
Analyzing dependencies
Fetching podspec for `HuPublicClassKit` from `../`
[!] Unable to find a specification for `HuUtilsKit` depended upon by `HuPublicClassKit`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

2. Your configuration specifies to merge with the ref 'refs/heads/master' from the remote, but no such ref was fetched.

在提交代碼這點遇到個BUG,我創(chuàng)建遠(yuǎn)端索引庫的時候沒有創(chuàng)建readme.md文件,也就是是個空倉庫。在提交的時候一直報錯卡在更新索引庫這步。網(wǎng)上找了半天也沒找到原因,最后重新生成了一個倉庫,添加了readme.md文件。在去提交索引庫就可以了。先前那個提交一直報錯的那個,我復(fù)制了個readme.md文件提交上去,然后再去提交索引庫就可以了。所以創(chuàng)建索引庫的時候一定不能是個空倉庫里面有啥都行就是不能為空。

解決辦法:隨便往倉庫放寫東西。

Updating the `testSpecs' repo

[!] /usr/local/bin/git -C /Users/huanghaipo/.cocoapods/repos/testSpecs pull

Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.

目前還在踩坑中。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容