在使用
cocoapods packageer
打包動(dòng)態(tài)庫(kù)的時(shí)候報(bào)錯(cuò)了吨艇。上一刻還是好的躬它,突然就不行了。
1. 問題描述
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=wrong+number+of+arguments+%28given+3%2C+expected+7..9%29&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- Swift Static Library support
https://github.com/CocoaPods/CocoaPods/pull/6966 [closed] [55 comments]
16 Mar 2018
2. 問題分析
首先东涡,看代碼提交記錄冯吓,將代碼回滾到了上一次打包成功時(shí)候的節(jié)點(diǎn)上,還是打包失敗软啼。
然后桑谍,看了一下 GitHub similar issues ,也沒有找到合適的答案祸挪。
一通折騰后锣披,想到可能是環(huán)境問題。
查看了一下 cocoapods 的版本號(hào):
? gem list --local | grep cocoapods
cocoapods (1.6.0)
cocoapods-core (1.6.0, 1.5.2, 1.4.0.beta.2, 1.4.0.beta.1, 1.3.1)
cocoapods-deintegrate (1.0.2, 1.0.1, 1.0.0)
cocoapods-downloader (1.2.2)
cocoapods-packager (1.5.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.1, 1.3.0, 1.1.1, 1.0.0)
cocoapods-try (1.1.0)
然后找另外一臺(tái)機(jī)器進(jìn)行對(duì)比,結(jié)果發(fā)現(xiàn)雹仿,另外一臺(tái)機(jī)器可以正常打包增热,可以正常打包機(jī)器的環(huán)境如下:
? ~ gem list --local | grep coc
cocoapods (1.5.3, 1.5.2)
cocoapods-core (1.5.3, 1.5.2)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.2.1, 1.2.0)
cocoapods-packager (1.5.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.0)
cocoapods-try (1.1.0)
問題定位成功,是 cocoapods 環(huán)境問題胧辽,出現(xiàn)這個(gè)問題的原因可能是自己執(zhí)行了一個(gè) gem 倉(cāng)庫(kù)更新的操作峻仇,導(dǎo)致所有的 gem 工具都升級(jí)了,cocoapods 也在其中邑商。
3. 解決方案
降低當(dāng)前設(shè)備上的 cocoapods 版本摄咆。
由于 cocoapods 是一套工具,工具之間有相互依賴關(guān)系人断,所以單獨(dú)降低 cocoapods 是不夠的吭从,需要將一整套工具的版本降低到合適版本。
所以恶迈,一不做二不休涩金,將含有 cocoapods 關(guān)鍵字的工具全部卸載,然后指定版本重新安裝一次暇仲。
卸載腳本如下:
for i in $( gem list --local --no-version | grep cocoapods );
do
gem uninstall $i;
done
腳本執(zhí)行完成之后步做,重新安裝 1.5.3
的 cocoapods。
? gem install cocoapods -v 1.5.3
重裝 cocoapods-packager奈附。
? gem install cocoapods-packager
安裝完成之后全度,重新運(yùn)行打包腳本,成功打包斥滤。