ios .podspec 错误 - source_files` 模式与任何文件都不匹配
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20915916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
.podspec error - source_files` pattern did not match any file
提问by Kevin
I am integrating one of my github repos(full code here if it helps) with Cocopods, and I get this error when I run pod spec lint
.
我正在将我的 github 存储库之一(如果有帮助,请在此处提供完整代码)与 Cocopods 集成,并且在运行pod spec lint
.
-> DropDownMenu (0.0.1)
- ERROR | [iOS] The `source_files` pattern did not match any file.
This is the relevant code of my .podspec
which I believe is causing the problem.
这是.podspec
我认为导致问题的相关代码。
Looking at examples here, here, and here, I have tried the following
s.source_files = 'Classes/*.{h,m}'
s.source_files = 'Classes/DropDownMenu.{h,m}'
s.source_files = 'Classes'
s.source_files = 'Classes/**/*.{h,m}'
Is my s.source_files
field incorrect? Or did I do something wrong with the .podspec
? What can I do to fix this?
我的s.source_files
领域不正确吗?还是我做错了.podspec
什么?我能做些什么来解决这个问题?
My problem is similar to this question, however the solution does not work for me (my code is updated on Github).
我的问题与此问题类似,但是该解决方案对我不起作用(我的代码已在 Github 上更新)。
回答by Andy
The problem is that your podspec is referencing a commit that did not yet have the Classes folder,
问题是你的 podspec 引用了一个还没有 Classes 文件夹的提交,
i.e. this commit doesn't have a classes folder yet https://github.com/kevinrandrup/DropDownMenu/tree/09c9b3d515b78550557eabc0a8542f9f6f2623cf
即此提交还没有类文件夹https://github.com/kevinrandrup/DropDownMenu/tree/09c9b3d515b78550557eabc0a8542f9f6f2623cf
You can fix this issue by referencing the latest commit, i.e. changing your podspec source to:
您可以通过引用最新提交来解决此问题,即将 podspec 源更改为:
s.source = { :git => "https://github.com/kevinrandrup/DropDownMenu.git", :commit => "0d6761feefccff1f7d8b7c7788ceb8e9cd1314ea" }
s.source_files = 'Classes/*.{h,m}'
回答by CodeBender
I got this problem after having CocoaPods generate the podspec file automatically for me with version 1.1.0 RC3.
在使用版本 1.1.0 RC3 让 CocoaPods 自动为我生成 podspec 文件后,我遇到了这个问题。
The original line in the Podspec file was:
Podspec 文件中的原始行是:
s.source_files = 'Pod/Classes/**/*'
I fixed it by changing it to:
我通过将其更改为:
s.source_files = 'NAME_OF_POD/Classes/**/*'
回答by Hajar Elkoumikhi
I had the same problem. I solved it by modifying that line to :
我有同样的问题。我通过将该行修改为:
spec.source_files = "POD NAME/**/*"
spec.source_files = "POD NAME/**/*"
回答by Lumialxk
I used git tag. It worked well for me.
我使用了 git 标签。它对我来说效果很好。
Step 1: Add tag
第一步:添加标签
git tag 1.0.2 && git push origin --tags
Step 2: Set source with tag
第 2 步:使用标签设置源
s.source = { :git => "https://github.com/kevinrandrup/DropDownMenu.git", :tag => s.version }
s.source_files = 'Classes/*.{h,m,swift}'
Pay attention to that your tag must be equal to you pod spec version.
请注意,您的标签必须与您的 pod 规格版本相同。
回答by Kiran Jasvanee
I've solved my issue by changing version number of my pod. Please check my answer at ERROR | [iOS] file patterns: The `source_files` pattern did not match any file
我已经通过更改 pod 的版本号解决了我的问题。请检查我在错误处的回答| [iOS] 文件模式:`source_files` 模式不匹配任何文件
回答by Binh Le
I got this issue. The right configuration should be:
我得到了这个问题。正确的配置应该是:
s.source = { :git => "https://github.com/kevinrandrup/DropDownMenu.git", :commit => "0d6761feefccff1f7d8b7c7788ceb8e9cd1314ea" }
s.source_files = 'Classes/**/*.{h,m}'
回答by YoungJeXu
two solutions: specify 1. the tag in the source payload,2. specify the commit number in the source payload.
两种解决方案: 1. 在源有效载荷中指定标签,2. 在源负载中指定提交编号。
回答by Ryan.Yuen
There are three steps to make it works.
有三个步骤可以使其工作。
1.Make sure the path specified to source_files
is correct.
1.确保指定的路径source_files
正确。
2.Make sure source folder is not empty. That means you must put some source files in it before execute pod lib lint
2.确保源文件夹不为空。这意味着您必须在执行之前将一些源文件放入其中pod lib lint
3.Before pushing repo to Git, make sure you have specified the right tag and pushed source files and tag
to the remote server.
3.在将 repo 推送到 Git 之前,请确保您已指定正确的标签并将源文件推tag
送到远程服务器。
回答by Oyvkva
I had deleted my resource folder and to fix the error I had to remove this from Project.podspec:
我已经删除了我的资源文件夹并修复了我必须从 Project.podspec 中删除它的错误:
#s.resource_bundles = {
# 'Project' => ['Resources/**/*.{png}']
#}