RuntimeError - [Xcodeproj] Unknown object version.解决方法

时间:2023-03-09 06:43:41
RuntimeError - [Xcodeproj] Unknown object version.解决方法
wjw:layoutInScrollView username$ pod install
Analyzing dependencies
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance ――― MARKDOWN TEMPLATE ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ### Command ```
/Users/username/.rvm/rubies/ruby-2.4./bin/pod install
``` ### Report * What did you do? * What did you expect to happen? * What happened instead? ### Stack ```
CocoaPods : 1.3.
Ruby : ruby 2.4.1p111 (-- revision ) [x86_64-darwin16]
RubyGems : 2.6.
Host : Mac OS X 10.13. (17E199)
Xcode : ()
Git : git version 2.15. (Apple Git-)
Ruby lib dir : /Users/username/.rvm/rubies/ruby-2.4./lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ bae6174a62acba399199f905e56b38f82581dd0e
``` ### Plugins ```
cocoapods-deintegrate : 1.0.
cocoapods-plugins : 1.0.
cocoapods-search : 1.0.
cocoapods-stats : 1.0.
cocoapods-trunk : 1.3.
cocoapods-try : 1.1.
``` ### Podfile ```ruby
platform :ios, '8.0' target:'layoutInScrollView' do pod "AFNetworking", '~> 3.1.0'
pod "Masonry", '~>1.1.0'
pod 'MBProgressHUD', '1.1.0' end
``` ### Error ```
RuntimeError - [Xcodeproj] Unknown object version.
/Users/username/.rvm/gems/ruby-2.4.@global/gems/xcodeproj-1.5./lib/xcodeproj/project.rb::in `initialize_from_file'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/xcodeproj-1.5./lib/xcodeproj/project.rb::in `open'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer/analyzer.rb::in `block ( levels) in inspect_targets_to_integrate'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer/analyzer.rb::in `each'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer/analyzer.rb::in `block in inspect_targets_to_integrate'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/user_interface.rb::in `section'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer/analyzer.rb::in `inspect_targets_to_integrate'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer/analyzer.rb::in `analyze'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer.rb::in `analyze'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer.rb::in `block in resolve_dependencies'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/user_interface.rb::in `section'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer.rb::in `resolve_dependencies'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/installer.rb::in `install!'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/command/install.rb::in `run'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/claide-1.0./lib/claide/command.rb::in `run'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./lib/cocoapods/command.rb::in `run'
/Users/username/.rvm/gems/ruby-2.4.@global/gems/cocoapods-1.3./bin/pod::in `<top (required)>'
/Users/username/.rvm/rubies/ruby-2.4./bin/pod::in `load'
/Users/username/.rvm/rubies/ruby-2.4./bin/pod::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...
- Pod init. Unknown object version
https://github.com/CocoaPods/CocoaPods/issues/7907 [closed] [2 comments]
weeks ago - RuntimeError - [Xcodeproj] Unknown object version.
https://github.com/CocoaPods/CocoaPods/issues/7697 [closed] [27 comments]
days ago - Unknown object version
https://github.com/CocoaPods/CocoaPods/issues/7760 [closed] [1 comment]
May and more at:
https://github.com/cocoapods/cocoapods/search?q=[Xcodeproj]%20Unknown%20object%20version.&type=Issues&utf8=✓
wjw:layoutInScrollView username$ ruby --v
ruby: invalid option --v (-h will show valid options) (RuntimeError)
wjw:layoutInScrollView username$ ruby -v
ruby 2.4.1p111 (-- revision ) [x86_64-darwin16]

引发这个问题的原因可能是我再工程中用cocopods导入了本地的SDK,中间有用到从本地添加sdk。

然后再新建其他项目时,再用cocopods 的 install命令就报了这个错。网上的答案很多。我试了很有效:

在终端执行命令:

gem install cocoapods --pre
wjw:layoutInScrollView username$ gem install cocoapods --pre
Fetching: cocoapods-core-1.5..gem (%)
Successfully installed cocoapods-core-1.5.
Fetching: cocoapods-deintegrate-1.0..gem (%)
Successfully installed cocoapods-deintegrate-1.0.
Fetching: cocoapods-downloader-1.2..gem (%)
Successfully installed cocoapods-downloader-1.2.
Fetching: molinillo-0.6..gem (%)
Successfully installed molinillo-0.6.
Fetching: atomos-0.1..gem (%)
Successfully installed atomos-0.1.
Fetching: nanaimo-0.2..gem (%)
Successfully installed nanaimo-0.2.
Fetching: xcodeproj-1.5..gem (%)
Successfully installed xcodeproj-1.5.
Fetching: cocoapods-1.5..gem (%)
Successfully installed cocoapods-1.5.
Parsing documentation for cocoapods-core-1.5.
Installing ri documentation for cocoapods-core-1.5.
Parsing documentation for cocoapods-deintegrate-1.0.
Installing ri documentation for cocoapods-deintegrate-1.0.
Parsing documentation for cocoapods-downloader-1.2.
Installing ri documentation for cocoapods-downloader-1.2.
Parsing documentation for molinillo-0.6.
Installing ri documentation for molinillo-0.6.
Parsing documentation for atomos-0.1.
Installing ri documentation for atomos-0.1.
Parsing documentation for nanaimo-0.2.
Installing ri documentation for nanaimo-0.2.
Parsing documentation for xcodeproj-1.5.
Installing ri documentation for xcodeproj-1.5.
Parsing documentation for cocoapods-1.5.
Installing ri documentation for cocoapods-1.5.
Done installing documentation for cocoapods-core, cocoapods-deintegrate, cocoapods-downloader, molinillo, atomos, nanaimo, xcodeproj, cocoapods after seconds
gems installed

执行 pod install

Analyzing dependencies
Downloading dependencies
Installing AFNetworking (3.1.)
Installing MBProgressHUD (1.1.)
Installing Masonry (1.1.)
Generating Pods project
Integrating client project [!] Please close any current Xcode sessions and use `layoutInScrollView.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are dependencies from the Podfile and total pods installed.