新建一個(gè)工程時(shí)析显,想使用pod導(dǎo)入幾個(gè)第三方庫因俐,但是遇到了下面的問題:
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
```
/usr/local/bin/pod init
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
? CocoaPods : 1.3.1
? ? ? ? Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
? ? RubyGems : 2.6.14
? ? ? ? Host : Mac OS X 10.13.6 (17G65)
? ? ? Xcode : 9.4.1 (9F2000)
? ? ? ? Git : git version 2.15.2 (Apple Git-101.1)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 3e5bfb65b4be67ff7da7635411e4ee0db312c042
```
### Plugins
```
cocoapods-deintegrate : 1.0.1
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
```
### Error
```
RuntimeError - [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.3/lib/xcodeproj/project.rb:217:in `initialize_from_file'
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.3/lib/xcodeproj/project.rb:102:in `open'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command/init.rb:41:in `validate!'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:333:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
```
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%5BXcodeproj%5D+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...
- RuntimeError - [Xcodeproj] Unknown object version.
? https://github.com/CocoaPods/CocoaPods/issues/7697 [closed] [31 comments]
? a day ago
- Pod Update: RuntimeError - [Xcodeproj] Unknown object version. Xcode Beta 5
? https://github.com/CocoaPods/CocoaPods/issues/8003 [closed] [17 comments]
? 19 Aug 2018
- RuntimeError - [Xcodeproj] Unknown object version.
? https://github.com/CocoaPods/CocoaPods/issues/7458 [closed] [15 comments]
? 30 Jul 2018
and 42 more at:
https://github.com/cocoapods/cocoapods/search?q=[Xcodeproj]%20Unknown%20object%20version.&type=Issues&utf8=?
RuntimeError - [Xcodeproj] Unknown object version.這句話的意思是Xcode工程版本與pod對不上银萍,于是敲入命令行g(shù)em install cocoapods --pre來更新pod的版本捂寿。
又遇到了一個(gè)錯(cuò)誤:
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
? ? ? ? ? Unable to download data from https://ruby.taobao.org/ - bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
gem的淘寶鏈接失效算色。于是把鏈接修改為新的有效鏈接羊异,命令行如下:
????刪除原有的資源鏈接:gem sources -r https://ruby.taobao.org/
? ? 添加新的有效資源鏈接:gem sources -a https://gems.ruby-china.com/
? ? 再次返回命令行敲入:gem install cocoapods --pre 重新安裝了pod
再執(zhí)行pod init
pod 初始化成功浇借。文件夾中出現(xiàn)了久違的Podfile捉撮。
希望對你們有幫助。