我在项目中添加了Apple Watch扩展程序,并且希望使用与主iOS应用程序相同的Pod。但是,我在iOS应用中使用的podspec具有依赖性,当我将watch扩展作为目标包含在podfile中时,该依赖性会导致错误。有没有一种方法可以删除基于平台的依赖关系(ios,watchos)?

错误:

[!] The platform of the target `My Watch Extension` (watchOS 5.2) is not compatible with `Library X (10.1.19)`, which does not support `watchos`.

到目前为止,我正在我的Podfile中执行以下操作:

target 'My Watch Extension' do
    platform :watchos, '5.2'
    pod 'MyPod', :path => 'MyPod'
end


然后,我在podspec中添加了以下内容:

s.platforms = { :ios => "10.0", :watchos => "5.2"}


是否可能需要分开podspec?

最佳答案

这是我的podfile的简化版本。我只是针对不同目标添加了不同的广告连播。

def external_dependencies
  pod 'Alamofire'
  pod 'SQLite.swift/SQLCipher'
end

def caller_id_external_dependencies
  pod 'GMCPagingScrollView'
  pod 'KeychainAccess'
end

target 'Goob' do
  external_dependencies
  internal_dependencies

  target 'UnitTests' do
    pod 'Firebase/Core'
    pod 'Firebase/Messaging'
    pod 'SQLite.swift/SQLCipher'

    inherit! :search_paths
  end

end

target 'GoobCallerId' do
  caller_id_external_dependencies
end

关于ios - 删除基于平台的Pod依赖,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57893346/

10-11 19:46