Travis CI build [Cocoapod Swift]失败,没有“此类模块……”错误

问题描述 投票:2回答:1

[我有一个用Swift编写的repository,这是一个标准的cocoapod工作区(标准格式,其中包含使用Quick和Nimble测试创建的示例应用程序,没有UI测试),可以在本地计算机上构建(并与测试一起运行) (Xcode 11.2.1,macOS Catalina 10.15.1)正常运行,但是Travis CI构建失败,并显示以下错误之一:模块不存在:

/Users/travis/build/Kentico/kontent-delivery-sdk-swift/Example/KenticoKontentDelivery/KontentModels/Cafe.swift:9:8: no such module 'ObjectMapper'

完整Travis CI日志here

[.podspec文件:

Pod::Spec.new do |s|
  s.name             = 'KenticoKontentDelivery'
  s.version          = '2.0.0'
  s.summary          = 'Swift SDK for Kentico Kontent Delivery'

  s.description      = <<-DESC
  Swift SDK for Kentico Kontent Delivery.
                       DESC

  s.homepage         = 'https://github.com/kentico/kontent-delivery-sdk-swift'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'makma' => '[email protected]' }
  s.source           = { :git => 'https://github.com/kentico/kontent-delivery-sdk-swift.git', :tag => s.version.to_s }
  s.social_media_url = 'https://twitter.com/kenticokontent'

  s.ios.deployment_target = '8.0'

  s.source_files = 'KenticoKontentDelivery/Classes/**/*'

  s.dependency 'AlamofireObjectMapper', '~> 5.2.0'
  s.dependency 'ObjectMapper', '~> 3.5.1'
  s.dependency 'Kanna', '~> 4.0.2'
  s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' }

end

Podfile

use_frameworks!
platform :ios, '12.0'

target 'KenticoKontentDelivery_Example' do
  pod 'KenticoKontentDelivery', :path => '../'
  pod 'AlamofireImage', '~> 3.6.0'
  pod 'ObjectMapper', '~> 3.5.1'
  pod 'AlamofireObjectMapper', '~> 5.2.0'


  target 'KenticoKontentDelivery_Tests' do
    inherit! :search_paths

    pod 'Quick', '~> 2.2.0'
    pod 'Nimble', '~> 7.0'
    pod 'ObjectMapper', '~> 3.5.1'
    pod 'AlamofireObjectMapper', '~> 5.2.0'
  end
end

.travis.yml

osx_image: xcode11.1
language: objective-c
cache: cocoapods
podfile: Example/Podfile
before_install:
- gem install cocoapods # Since Travis is not always on latest version
- pod repo update
- pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/KenticoKontentDelivery.xcworkspace -scheme KenticoKontentDelivery-Example -sdk iphonesimulator -destination 'name=iPhone 8' ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
after_success:
- bash <(curl -s https://codecov.io/bash)
deploy:
  provider: script
  script: sh ./scripts/push.sh
  skip_cleanup: true
  on:
    tags: true

我尝试过的内容:

  • 所有依赖项的变更版本
  • 已更改的osx_image版本
swift cocoapods travis-ci
1个回答
0
投票
我终于调整了设置,以便能够在Travis CI上成功运行。我不确定哪个设置会影响结果,但是,在进行了这些更改之后,构建和测试将顺利进行。

    IPHONEOS_DEPLOYMENT_TARGET降级为版本11
© www.soinside.com 2019 - 2024. All rights reserved.