.podspec错误 - source_files`模式与任何文件都不匹配

时间:2014-01-04 02:02:31

标签: ios cocoapods

我正在使用Cocopods集成one of my github repos(如果有帮助的话,这里有完整的代码),当我运行pod spec lint时,我收到此错误。

 -> DropDownMenu (0.0.1)
  - ERROR | [iOS] The `source_files` pattern did not match any file.

这是我认为导致问题的.podspec的相关代码。

查看示例hereherehere,我尝试了以下内容

s.source_files  = 'Classes/*.{h,m}'
s.source_files  = 'Classes/DropDownMenu.{h,m}'
s.source_files  = 'Classes'
s.source_files  = 'Classes/**/*.{h,m}'

我的s.source_files字段是否错误?或者我对.podspec做错了什么?我该怎么做才能解决这个问题?

我的问题类似于this question,但解决方案对我不起作用(我的代码在Github上更新)。

11 个答案:

答案 0 :(得分:45)

问题是你的podspec引用了一个还没有Classes文件夹的提交,

即。此提交还没有类文件夹https://github.com/kevinrandrup/DropDownMenu/tree/09c9b3d515b78550557eabc0a8542f9f6f2623cf

您可以通过引用最新提交来修复此问题,即将podspec源更改为:

s.source       = { :git => "https://github.com/kevinrandrup/DropDownMenu.git", :commit => "0d6761feefccff1f7d8b7c7788ceb8e9cd1314ea" }
s.source_files  = 'Classes/*.{h,m}'

答案 1 :(得分:6)

在CocoaPods为版本1.1.0 RC3自动生成podspec文件后,我遇到了这个问题。

Podspec文件中的原始行是:

s.source_files = 'Pod/Classes/**/*'

我通过将其更改为:

来修复它
s.source_files = 'NAME_OF_POD/Classes/**/*'

答案 2 :(得分:2)

我使用了git标签。它对我有用。

第1步:添加标签

git tag 1.0.2 && git push origin --tags

第2步:使用标记

设置源代码
s.source       = { :git => "https://github.com/kevinrandrup/DropDownMenu.git", :tag => s.version }
s.source_files  = 'Classes/*.{h,m,swift}'
  

注意您的标记必须与pod规格版本相同。

答案 3 :(得分:0)

我遇到了这个问题。正确的配置应该是:

s.source       = { :git => "https://github.com/kevinrandrup/DropDownMenu.git", :commit => "0d6761feefccff1f7d8b7c7788ceb8e9cd1314ea" }
s.source_files  = 'Classes/**/*.{h,m}'

答案 4 :(得分:0)

我通过更改我的广告连播的版本号解决了我的问题。请在ERROR | [iOS] file patterns: The `source_files` pattern did not match any file

查看我的回答

答案 5 :(得分:0)

两种解决方案: 指定1.源有效负载中的标记,2。指定源有效负载中的提交编号。

答案 6 :(得分:0)

要使其正常工作,需要执行三个步骤。

1。。确保指定给source_files的路径正确。

2。。确保源文件夹不为空。这意味着您必须在执行pod lib lint

之前放入一些源文件。

3。。在将回购推送到Git之前,请确保已指定正确的标记并将源文件和tag推送到远程服务器。

答案 7 :(得分:0)

我有同样的问题。我通过将该行修改为

来解决了该问题

spec.source_files = "POD NAME/**/*"

答案 8 :(得分:0)

添加

spec.source_files  = "YOUR_POD_NAME/**/*.{h,m,swift}"

解决了我的问题

答案 9 :(得分:0)

步骤1:添加标签

git tag 0.1.3 && git push --tags

步骤2:使用上面的标签指定源文件

s.source           = { :git => 'https://github.com/harryzhang1005/HGCommonLibrary.git', :tag => s.version.to_s }
s.source_files  = 'Classes/*.{h,m,swift}'

第3步:验证规格

pod spec lint HGCommonLibrary.podspec --allow-warnings

步骤4:推送至规格库

pod repo push harry-specs HGCommonLibrary.podspec --allow-warnings

答案 10 :(得分:-1)

我删除了我的资源文件夹并修复了我必须从Project.podspec中删除它的错误:

#s.resource_bundles = {
#  'Project' => ['Resources/**/*.{png}']
#}