Xcode9.1 CocoaPods1.0.1 'pod init' error

Xcode9.1 CocoaPods1.0.1 在执行 pod init 时 报错

RuntimeError - [Xcodeproj] Unknown object version.
/Users/sogou/.rvm/gems/ruby-2.2.2@global/gems/xcodeproj-1.3.0/lib/xcodeproj/project.rb:217:in `initialize_from_file'
Xcode9.1 CocoaPods1.0.1 'pod init' error_第1张图片
Error.png

原因是CocoaPods 和Xcode 版本不兼容所致,目前Xcode 9.1,CocoaPods1.0.1 需要升级 CocoaPods

  • 查询pod 命令
pod --help 
Usage:

    $ pod COMMAND

      CocoaPods, the Cocoa library package manager.

Commands:

    + cache         Manipulate the CocoaPods cache
    + deintegrate   Deintegrate CocoaPods from your project
    + env           Display pod environment
    + init          Generate a Podfile for the current directory
    + install       Install project dependencies according to versions from a
                    Podfile.lock
    + ipc           Inter-process communication
    + lib           Develop pods
    + list          List pods
    + outdated      Show outdated project dependencies
    + plugins       Show available CocoaPods plugins
    + repo          Manage spec-repositories
    + search        Search for pods
    + setup         Setup the CocoaPods environment
    + spec          Manage pod specs
    + trunk         Interact with the CocoaPods API (e.g. publishing new specs)
    + try           Try a Pod!
    + update        Update outdated project dependencies and create new
                    Podfile.lock

Options:

    --silent        Show nothing
    --version       Show the version of the tool
    --verbose       Show more debugging information
    --no-ansi       Show output without ANSI codes
    --help          Show help banner of specified command
  • 更新版本
gem install cocoapods --pre
Fetching: activesupport-4.2.10.gem (100%)
Successfully installed activesupport-4.2.10
Fetching: cocoapods-core-1.4.0.gem (100%)
Successfully installed cocoapods-core-1.4.0
Fetching: claide-1.0.2.gem (100%)
Successfully installed claide-1.0.2
Fetching: cocoapods-deintegrate-1.0.2.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.2
Fetching: cocoapods-downloader-1.1.3.gem (100%)
Successfully installed cocoapods-downloader-1.1.3
Fetching: netrc-0.11.0.gem (100%)
Successfully installed netrc-0.11.0
Fetching: cocoapods-trunk-1.3.0.gem (100%)
Successfully installed cocoapods-trunk-1.3.0
Fetching: molinillo-0.6.4.gem (100%)
Successfully installed molinillo-0.6.4
Fetching: atomos-0.1.2.gem (100%)
Successfully installed atomos-0.1.2
Fetching: CFPropertyList-2.3.6.gem (100%)
Successfully installed CFPropertyList-2.3.6
Fetching: colored2-3.1.2.gem (100%)
Successfully installed colored2-3.1.2
Fetching: nanaimo-0.2.3.gem (100%)
Successfully installed nanaimo-0.2.3
Fetching: xcodeproj-1.5.6.gem (100%)
Successfully installed xcodeproj-1.5.6
Fetching: fourflusher-2.0.1.gem (100%)
Successfully installed fourflusher-2.0.1
Fetching: gh_inspector-1.1.1.gem (100%)
Successfully installed gh_inspector-1.1.1
Fetching: ruby-macho-1.1.0.gem (100%)
Successfully installed ruby-macho-1.1.0
Fetching: cocoapods-1.4.0.gem (100%)
Successfully installed cocoapods-1.4.0
Parsing documentation for activesupport-4.2.10
Installing ri documentation for activesupport-4.2.10
Parsing documentation for cocoapods-core-1.4.0
Installing ri documentation for cocoapods-core-1.4.0
Parsing documentation for claide-1.0.2
Installing ri documentation for claide-1.0.2
Parsing documentation for cocoapods-deintegrate-1.0.2
Installing ri documentation for cocoapods-deintegrate-1.0.2
Parsing documentation for cocoapods-downloader-1.1.3
Installing ri documentation for cocoapods-downloader-1.1.3
Parsing documentation for netrc-0.11.0
Installing ri documentation for netrc-0.11.0
Parsing documentation for cocoapods-trunk-1.3.0
Installing ri documentation for cocoapods-trunk-1.3.0
Parsing documentation for molinillo-0.6.4
Installing ri documentation for molinillo-0.6.4
Parsing documentation for atomos-0.1.2
Installing ri documentation for atomos-0.1.2
Parsing documentation for CFPropertyList-2.3.6
Installing ri documentation for CFPropertyList-2.3.6
Parsing documentation for colored2-3.1.2
Installing ri documentation for colored2-3.1.2
Parsing documentation for nanaimo-0.2.3
Installing ri documentation for nanaimo-0.2.3
Parsing documentation for xcodeproj-1.5.6
Installing ri documentation for xcodeproj-1.5.6
Parsing documentation for fourflusher-2.0.1
Installing ri documentation for fourflusher-2.0.1
Parsing documentation for gh_inspector-1.1.1
Installing ri documentation for gh_inspector-1.1.1
Parsing documentation for ruby-macho-1.1.0
Installing ri documentation for ruby-macho-1.1.0
Parsing documentation for cocoapods-1.4.0
Installing ri documentation for cocoapods-1.4.0
Done installing documentation for activesupport, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, netrc, cocoapods-trunk, molinillo, atomos, CFPropertyList, colored2, nanaimo, xcodeproj, fourflusher, gh_inspector, ruby-macho, cocoapods after 19 seconds
17 gems installed
  • 成功下载最新版本之后可以进行正常创建podfile
pod init
pod install

balabalabala...

你可能感兴趣的:(Xcode9.1 CocoaPods1.0.1 'pod init' error)