我有一个以下格式的 git 存储库:
MyApp/
Podfile
....
TestHelperPod/
Classes/
.h & .m files
TestHelperPod.podspec
Run Code Online (Sandbox Code Playgroud)
MyApp 文件夹中的 podfile 有一行如下所示:
pod 'TestHelperPod', :path => '../TestHelperPod'
Run Code Online (Sandbox Code Playgroud)
我的 podspec 的 source_files 模式如下所示:
Pod::Spec.new do |s|
//...
s.source_files = "TestHelperPod/Classes/*.{h,m}"
end
Run Code Online (Sandbox Code Playgroud)
当我pod spec lint在 podspec 上执行 a 操作时,它似乎成功了,并选取了目录中的所有类Classes来构建它们。然而,当我实际在 MyApp 中尝试时pod install,Pods 项目不会生成并引用目录中的类Classes。Classes当目录也被命名TestHelperPod且 source_files 模式为 时,这曾经有效TestHelperPod/**/*.{h,m},但我不希望文件夹结构中出现重复。其中带有 ** 的模式也不适用于这个新结构。有任何想法吗?在撰写本文时,我正在运行最新版本的 cocoapods,0.32.1。
弄清楚了; 将 source_files 行更改为:
s.source_files = "Classes/*.{h,m}"
Run Code Online (Sandbox Code Playgroud)
工作过;cocoapods.org 上的文档建议源文件模式必须位于存储库的顶部,这就是为什么我认为我需要 TestHelperPod 在那里,即使 podspec 已经在该文件夹中。