記錄一次cocoaPods的更新過程


是這樣的安裝cocoaPods需要ruby環境,ruby的管理需要nvm,nvm的升級需要homebrew.
homebrew的升級依賴外網。
所以我們這樣做
1、安裝或升級homebrew
2、安裝或更新ruby,選擇較新版本
3、安裝cocoaPods

1、安裝或升級homebrew

對於不能上網的同學,不用大費周折中科大有搭建通過國內鏡像方便開發人員安裝。

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

引用地址
成功后查看版本

wjw@192 ~ % brew -v
Homebrew 3.3.10-21-g3ba6afb
Homebrew/homebrew-core (git revision fb70b1db1e5; last commit 2022-01-12)
Homebrew/homebrew-cask (git revision bccfa8bf06; last commit 2022-01-12)
wjw@192 ~ % 

2、安裝或更新ruby,選擇較新版本

由於蘋果自帶了ruby,之前在安裝cocoaPods的時候也安裝了其它版本的ruby,
通過舊版本的brew安裝ruby還是怎么安裝自己都忘了,
這時候推薦安裝rvm,在選擇相應版本的ruby.
安裝rvm 命令

# 一般這個命令執行后,rvm會自動切換最新版本的ruby為默認使用版本
\curl -sSL https://get.rvm.io | bash -s stable --ruby
 source ~/.bashrc
 source ~/.bash_profile
#列出已知的ruby版本
rvm list konwn

#安裝指定版本的ruby
rvm install 3.4.0 --disable-binary
# 切換ruby版本
rvm use 3.0.0
# 設置默認版本
rvm use 3.0.0 --default
# 查詢已安裝的ruby
rvm list
# 卸載已安裝的版本
rvm remove 2.2.0

2.2 安裝brew和rvm的時候出現的問題,需要切換dns

報錯信息:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
github上的解決方案
switchhosts 小工具挺好用的
switchhosts下載地址

3、安裝cocoaPods

sudo gem install cocoapods

安裝好后記得 終端重啟以下不然會出現 第四部分的大片報錯,ruby的版本和cocoapods版本不匹配

4、pod install 時遇到的問題:

wjw@192 DemoInOne % pod install
Analyzing dependencies

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

/Users/wjw/.rvm/rubies/ruby-2.4.1/bin/pod install


### Report

* What did you do?

* What did you expect to happen?

* What happened instead?


### Stack

CocoaPods : 1.10.1
Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
RubyGems : 2.7.7
Host : macOS 11.5.2 (20G95)
Xcode : 13.0 (13A233)
Git : git version 2.30.1 (Apple Git-130)
Ruby lib dir : /Users/wjw/.rvm/rubies/ruby-2.4.1/lib
Repositories : master - git - https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git @ 916c5c945adee63bb321d04ed90df554bc818af4

           trunk - CDN - https://cdn.cocoapods.org/

### Plugins

cocoapods-clean : 0.0.1
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0


### Podfile

```ruby
platform :ios, '9.0'

target:'DemoInOne' do
    
pod 'AFNetworking', '~> 3.1.0'
pod 'Masonry', '~>1.1.0'
pod 'MBProgressHUD', '1.1.0'
pod 'YYKit', '~> 1.0.9'
#pod 'YYCache', '~> 1.0.4'
#pod 'YYModel', '~> 1.0.4'
pod 'IQKeyboardManager'
pod 'BaiduMapKit', '~> 6.0.0'
pod 'BMKLocationKit', '~> 2.0.0'
# pod 'MMDrawerController', '~> 0.6.0'
# pod 'MLeaksFinder'
# pod 'SDWebImage', '~> 4.3.3'
# pod 'FBRetainCycleDetector', '~> 0.1.4'
# pod 'RadioButton'
# pod 'LeakFinder'
# pod 'DXPopover', '~> 0.1.1'
# pod 'LFKit/Component/LFBubbleView'
# pod 'WYPopoverController', '~> 0.2.0'
# pod 'FMDB', '~> 2.7.2'
# pod 'MJRefresh', '~> 3.1.15.3'
# pod 'JPFPSStatus', '~> 0.1.1'
# pod 'FHHFPSIndicator'
# pod 'HJCornerRadius', :git => 'https://github.com/panghaijiao/HJCornerRadius.git'
# pod 'CocoaLumberjack', '~> 3.4.2'
# pod 'SAMKeychain', '~> 1.5.3'
# pod "PromiseKit/CorePromise", "~> 6.8"
end

Error

RuntimeError - [Xcodeproj] Unknown object version.
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:227:in `initialize_from_file'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:112:in `open'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1186:in `block (2 levels) in inspect_targets_to_integrate'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1185:in `each'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1185:in `block in inspect_targets_to_integrate'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1180:in `inspect_targets_to_integrate'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:106:in `analyze'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Users/wjw/.rvm/gems/ruby-2.4.1@global/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/Users/wjw/.rvm/rubies/ruby-2.4.1/bin/pod:23:in `load'
/Users/wjw/.rvm/rubies/ruby-2.4.1/bin/pod:23:in `<main>'
/Users/wjw/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:22:in `eval'
/Users/wjw/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:22:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=[Xcodeproj]+Unknown+object+version.&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...

and 75 more at:
https://github.com/cocoapods/cocoapods/search?q=[Xcodeproj] Unknown object version.&type=Issues&utf8=✓
wjw@192 DemoInOne %


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM