CocoaPods版本升級問題

廢話不多說、直接解釋

在下載某個ios源碼后,我們需要在控制器進入目錄之后執行pod install:

$ pod install
然而會報錯、如下

[!] Unable to find a specification for CrabCrashReporter


因此我們需要更新cocoapods,執行下面的命令,但是并沒有更新成功。
`$ gem update cocoapod`
> `Updating installed gems Nothing to update`

查看當前版本:

`$ pod --version`
> `1.0.1`

懷疑source地址有變化:

`$ gem sources `
>```-l*** CURRENT SOURCES *** 
http://ruby.taobao.org/```

網上查看,告知taobao服務器已經改為https協議,因此執行如下:

`$ gem sources`
>``` -r http://ruby.taobao.org/http://ruby.taobao.org/ removed from sources $ gem sources -a https://ruby.taobao.org/https://ruby.taobao.org/ added to sources```

更新系統,提示沒有權限:
$ gem update --system Updating rubygems-updateFetching: rubygems-update-2.5.1.gem (100%)ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
使用sudo來執行操作:

`$ sudo gem update --system`
> `Updating rubygems-updateFetching: rubygems-update-2.5.1.gem (100%)Successfully installed rubygems-update-2.5.1 Parsing documentation for rubygems-update-2.5.1`

執行安裝:

`$ pod setup`
>`Setting up CocoaPods master repoSetup completed [!] CocoaPods was not able to update the `master `repo. `
`If this is an unexpected issue and persists you can inspect it running  `pod repo update --verbos ` `

根據提示執行repo更新:

`$ pod repo update --verbose `
> `Updating spec repo `master` $ /usr/bin/git pull --ff-only From https://github.com/CocoaPods/Specs a0baa68..9a14a05 master -> origin/master error: Your local changes to the following files would be overwritten by merge: CocoaPods-version.yml Specs/1PasswordExtension/1.0.0/1PasswordExtension.podspec.json Specs/1PasswordExtension/1.0.1/1PasswordExtension.podspec.json Specs/AKUTestKit/1.1.2/AKUTestKit.podspec.json Specs/ALCore Aborting Updating a5c6b67..9a14a05 [!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose``

master分支還是失敗,查看網上建議,先清除緩存

`rm -rf ~/.cocoapods/repos/master`
再重新運行:

`$ pod setup`
> `Setting up CocoaPods master repo CocoaPods 1.0.0.beta.2 is available.To update use: `gem install cocoapods --pre`[!] This is a test version we'd love you to try. For more information see http://blog.cocoapods.organd the CHANGELOG for this version http://git.io/BaH8pQ. Setup completed`

`$ gem install cocoapods`
> `........Installing ri documentation for cocoapods-1.1.1
Done installing documentation for gh_inspector, fourflusher, activesupport, claide, xcodeproj, molinillo, cocoapods-trunk, cocoapods-downloader, cocoapods-deintegrate, cocoapods-core, cocoapods after 15 seconds
11 gems installed`

最后,到下載的ios工程目錄下,執行:
 `$  pod --version`
> `1.1.1`

`$ pod install`
> `Updating local specs repositories CocoaPods 1.0.0.beta.2 is available.To update use: `gem install cocoapods --pre`[!] 
This is a test version we'd love you to try. For more information see http://blog.cocoapods.organd the CHANGELOG for this version http://git.io/BaH8pQ. Analyzing dependenciesDownloading dependenciesInstalling AFNetworking (2.6.3)Installing AFOnoResponseSerializer (1.0.0)Installing DTCoreText (1.6.17)`

可見現在問題解決了!





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

推薦閱讀更多精彩內容