用“eval pod安装”的Travis-CI错误

我的.travis.yml文件:

 language: objective-c script: xctool -workspace ProjectName.xcworkspace -scheme ProjectName build -sdk iphonesimulator 

Travis-CI正在build设这个项目时说:

 $ bundle --version Bundler version 1.7.4 $ xcodebuild -version -sdk $ pod --version 0.34.4 Installing Pods with 'pod install' $ pushd . ~/build/GabrielMassana/ProjectName-iOS $ pod install 

安装荚时,错误是:

 The command "eval pod install" failed. Retrying, 2 of 3. The command "eval pod install" failed. Retrying, 3 of 3. The command "eval pod install" failed 3 times. The command "pod install" failed and exited with 1 during . Your build has been stopped. 

我发现添加这条线可以解决我的问题。

 before_install: - rvm use system - sudo gem install cocoapods -v '0.39.0' 

所以我最后的.travis.yml文件:

 language: objective-c before_install: - rvm use system - sudo gem install cocoapods -v '0.39.0' script: xctool -workspace ProjectName.xcworkspace -scheme ProjectName build -sdk iphonesimulator 

现在cocoapods完成安装。

可能有些Travis机器设置为使用旧版本(0.34.4)

我还在我的博客中写了一篇关于Travis-CI的文章。