为什么 Travis-CI 找不到我的 cocoapod 依赖项?

Why can't Travis-CI find my cocoapod dependencies?

此 Podspec 在行 pod 'SwiftyTimer', '~> 1.4'Unable to find a specification for SwiftyTimer 上失败。它在本地安装良好。

我尝试过的事情:

我的播客文件:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'
use_frameworks!

target 'CWNotificationBanner_Example' do
  pod 'SwiftyTimer', '~> 1.4'
  pod 'CWNotificationBanner', :path => '../'

  target 'CWNotificationBanner_Tests' do
    inherit! :search_paths

    pod 'Quick', '~> 0.8'
    pod 'Nimble', '~> 3.0'
    pod 'FBSnapshotTestCase'
    pod 'Nimble-Snapshots'
  end
end

我的travis.yml:

language: objective-c

podfile: Example/Podfile
before_install:
 - rvm install ruby-2.2.2 #cocoapods 1.0.0 requirement not yet supported ootb by travis
 - gem install cocoapods # Since Travis is not always on latest version
 - pod install --project-directory=Example
script:
 - set -o pipefail && xctool test -workspace Example/CWNotificationBanner.xcworkspace -scheme CWNotificationBanner-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty
 - pod lib lint

您可能需要执行 pod repo update 以确保 Podspec 在最新的存储库中。

结果是:在我的 .travis.yml:

中的 osx_image 键中指定一个 xcode 版本
language: objective-c
osx_image: xcode7.3
xcode_workspace: Example/CWNotificationBanner.xcworkspace
xcode_scheme: CWNotificationBanner-Example
xcode_sdk: iphonesimulator9.3
podfile: Example/Podfile

在我的例子中,这是因为 CI 机器上缺少 pod 规范。要修复它,您需要在 travis.yml 文件中添加 before_install

before_install:
  - pod repo update