我的 podspec 看起来像这样:
Pod::Spec.new do |s|
s.name = 'flutter_vlc_player'
s.version = '0.0.3'
s.summary = 'A new Flutter project.'
s.description = <<-DESC
A new Flutter project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => '[email protected]' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'MobileVLCKit', '~> 3.3.10'
s.static_framework = true
s.ios.deployment_target = '9.0'
end
如何设置
:modular_headers => true
为 s.dependency 'MobileVLCKit', '~> 3.3.10'
?我尝试使用类似
s.dependency 'MobileVLCKit', '~> 3.3.10', :modular_headers => true
和我在podfile中做的一样,但是没用。
我知道我可以在
'DEFINES_MODULE' => 'YES'
中使用 pod_target_xcconfig
,但是由于 MobileVLCKit
依赖性,它没有解决非模块化标头的问题。
截至 2021 年 9 月我的最后一次知识更新,CocoaPods 不直接支持为 Podspec 中的各个依赖项指定 :modular_headers => true。 :modular_headers 选项通常在 Podfile 中使用来启用或禁用所有依赖项的模块化标头。但是,您无法为 Podspec 中的每个依赖项单独设置它。
如果“MobileVLCKit”默认不提供模块化标头,您将无法在 Podspec 中仅针对此依赖项启用它们。相反,您可能需要考虑其他方法,例如对整个 pod 目标使用 DEFINES_MODULE 或请求“MobileVLCKit”的维护者在未来版本中提供模块化标头。
以下是如何在 Podspec 中为整个 pod 目标设置 DEFINES_MODULE:
Pod::Spec.new do |s|
# ...
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES'
}
s.dependency 'MobileVLCKit', '~> 3.3.10'
end
但是,正如您所提到的,如果“MobileVLCKit”本身不提供模块化标头,则此方法可能无法按预期工作。
要使“MobileVLCKit”与模块化标头兼容,您需要:
等待“MobileVLCKit”的维护者发布支持模块化标头的版本。
分叉“MobileVLCKit”并自行添加模块化标头支持。这将涉及修改“MobileVLCKit”项目并创建一个自定义版本,然后您可以在项目中使用该版本。
请注意,自 2021 年 9 月我上次更新以来,模块化标头的状态以及与 CocoaPods 的兼容性可能已经发生变化,因此最好检查最新文档和社区讨论以了解该领域的任何更新或更改。