遇到未知错误(CocoaPods找不到Pod的兼容版本

时间:2018-08-21 12:17:40

标签: swift cocoapods pod podspec

我正在创建广告连播。 我在掉毛时遇到此错误: pod spec lint TrackerExample.podspec --no-clean --use-libraries

我距离Pod验证有1个错误。您能帮忙弄清楚什么缺失或需要修订吗。

这是我的podspec:

Pod::Spec.new do |spec|
  spec.name         = "TrackerExample"
  spec.version      = "0.0.1"
  spec.license      = "Copyright ****"
  spec.homepage     = "https:// *****"
  spec.author       = { "*****" => "*******" }
  spec.summary      = "some description"
  spec.source   = { :git => "******t" }  
  spec.source_files  = "TrackerExample/*.{h,m}"
  spec.ios.deployment_target = "9.0"
  spec.osx.deployment_target = "10.10"
  spec.swift_version = '4.0'
  spec.dependency 'MatomoTracker', '5.2'
  spec.subspec 'MatomoTracker' do |lib|
    lib.dependency 'MatomoTracker', '5.2'
    lib.source_files = "Pods/MatomoTracker/MatomoTracker/*.{h,m,swift}"
  end
end

,这是终端输出。我收到以下错误:

ERROR | [OSX] unknown: Encountered an unknown error (CocoaPods could not find compatible versions for pod "MatomoTracker":




-> TrackerExample (0.0.1)
    - WARN  | source: Git sources should specify a tag.
    - WARN  | [iOS] license: Unable to find a license file
    - WARN  | xcodebuild:  MatomoTracker/MatomoTracker/EventSerializer.swift:15:19: warning: 'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value
    - NOTE  | xcodebuild:  MatomoTracker/MatomoTracker/EventSerializer.swift:15:19: note: use 'compactMap(_:)' instead
    - WARN  | xcodebuild:  TrackerExample/Pods/MatomoTracker/MatomoTracker/EventSerializer.swift:15:19: warning: 'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value
    - NOTE  | xcodebuild:  TrackerExample/Pods/MatomoTracker/MatomoTracker/EventSerializer.swift:15:19: note: use 'compactMap(_:)' instead
    - ERROR | [OSX] unknown: Encountered an unknown error (CocoaPods could not find compatible versions for pod "MatomoTracker":
  In Podfile:
    TrackerExample (from `/Users/s.ludosky/Documents/projects/ios/libs/TrackerExample/TrackerExample.podspec`) was resolved to 0.0.1, which depends on
      MatomoTracker (= 5.2)

Specs satisfying the `MatomoTracker (= 5.2)` dependency were found, but they required a higher minimum deployment target.) during validation.

Pods workspace available at `/var/folders/n8/9jmhgp1x2hxgg7_r4ryvs7tcn166k1/T/CocoaPods-Lint-20180821-86279-qyai9s-TrackerExample/App.xcworkspace` for inspection.

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error and 4 warnings.

与podfile相关的内容。我确实将Pod版本指定为 5.2 。为什么这与我自己的广告连播的 0.0.1 版本冲突?

fyi,这是我正在使用的“ MatomoTracker”依赖项的podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'TrackerExample' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TrackerExample
  pod 'MatomoTracker', '~> 5.2'
end

1 个答案:

答案 0 :(得分:1)

如果您在运行pod spec lint的目录中创建具有所需版本(例如“ 4.0”)的名为.swift-version的文件 echo“ 4.0”> .swift-version

它可以解决您的问题。

也只需执行以下步骤:-

  1. pod解体
  2. pod安装
  3. pod更新(如果有必要,则更新,如果您拥有所有最新的pod,则不要使用它。)