创建一个具有已编译框架作为依赖项的cocoapod

时间:2020-11-01 23:03:02

标签: ios xcode cocoapods pod podspec

我正在创建一个Cocoapod(MyPod),它支持具有框架依赖性的iOS和tvOS。我没有访问框架代码的权限,但是拥有已编译的框架,因此将其称为ThirdParty.framework。 iOS和tvOS的框架版本不同。

我能够直接在Xcode中成功构建构建MyPod目标,并在其他项目中使用生成的框架。但是,要创建pod,在我运行pod lib lint时会显示错误:

error: failed to build module 'ThirdParty' from its module interface; the compiler that produced it, 'Apple Swift version 5.1.2 (swiftlang-1100.0.278 clang-1100.0.33.9)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)'

这是我的podspec:

 s.name             = 'MyPod'
 Pod::Spec.new do |s|
   s.name             = 'MyPod'
   s.version          = '0.1.0'
   s.summary          = 'This is MyPod'
   s.description      = <<-DESC
  Provides functionality for ....
                        DESC
   s.static_framework = true
   s.homepage         = 'https://github.com/username/MyPod'
   s.license          = { :type => 'MIT', :file => 'LICENSE' }
   s.author           = { 'username' => 'myemail@email.com' }
   s.source           = { :git => 'https://github.com/username/MyPod.git', :tag => s.version.to_s }
   s.ios.deployment_target = '13.0'
   s.swift_versions = '5.0'
   s.ios.source_files = 'MyPod/Common/**/*.swift', 'MyPod/Platform/iOS/**/*.swift'
   s.tvos.source_files = 'MyPod/Common/**/*.swift', 'MyPod/Platform/tvOS/**/*.swift'
   s.ios.vendored_frameworks = 'MyPod/Frameworks/ios/universal/ThirdParty.framework'
   s.tvos.vendored_frameworks = 'MyPod/Frameworks/tvos/universal/ThirdParty.framework'
   s.preserve_path = 'MyPod/Frameworks'
end

我不完全理解该错误,但似乎当我运行pod lib lint时,cocoapods试图重建框架。因此,问题是,有没有一种方法可以链接ThirdParty.framework,而无需构建它来解决此错误?

0 个答案:

没有答案