【问题标题】:Problems with source_files in cocoapodscocoapods 中的 source_files 问题
【发布时间】:2014-05-19 13:26:01
【问题描述】:

我是 iOS 编程和 cocoaPods 领域的新手,我对“pod lib lint”有疑问(好吧,实际上我有很多问题,因为我还在学习:P)。 问题是我的 podspec 文件位于两个不同的文件中,位于不同的文件夹中。在第一个中,当我执行“pod lib lint”时,它说一切正常,但在第二个中(这是第一个的副本,但在 cocoaPods 项目中,准备执行拉取请求)抛出此错误:

- ERROR | The `source_files` pattern did not match any file.
- WARN  | Unable to find a license file

我在谷歌上搜索了一下,很多人都遇到了这个错误的问题,但是没有人说根据路径会出现问题。

我的 podspec 文件中“有趣”的部分是

Pod::Spec.new do |s|
  s.name             = "countdown"
  s.version          = "0.2.1"
  s.summary          = "Countdown is a class to implement a timer used to do a countdown"
  s.description      = <<-DESC
                       Countdown was created to provide a simple and fast way to create our own countdown in apps that need this feature. This countdown counts in seconds, but when the remaining time is less than one minute it counts in tenths.

As you will see, right now is a very simple class, with just some methods to use, but we will upload more methods as soon as somebody need it.

Please, if you want to help us to improve Countdown, send us your opinion to info@omitsis.com or just comment here ;-)
                       DESC
  s.homepage         = "http://www.omitsis.com/"
  s.license          = 'MIT'
  s.author           = { "Omitsis Consilting S.L." => "info@omitsis.com" }
  s.source           = { :git => "https://github.com/omitsis/countdown-ios.git", :tag => "v0.2.1" }
  s.social_media_url = 'https://twitter.com/omitsis'

  s.requires_arc = true

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

  s.ios.exclude_files = 'Classes/osx'
  s.frameworks  = 'XCTest', 'Foundation'
end

有人可以帮我解决这个问题吗? 谢谢大家,如果这个问题很“菜鸟级别”,我很抱歉:)。

【问题讨论】:

  • 最好将整个 pod-spec 文件添加到这个问题中。
  • 当然!我只是编辑原始帖子:D。感谢您的快速回答!
  • 两件事。我相信您应该使用“pod spec lint”来测试您的 podspec。我试过你的代码并验证得很好。请看下面我的回答。其次,不要以非正式的方式写你的 SO 问题。阅读起来很麻烦,给问题增加了噪音,并且可能会被可以提供帮助的人跳过。它还有助于使非英语使用者难以阅读。正式、准确和简洁。 StackoverFlow Hates Fun
  • 感谢您的帮助和关于非正式语言的建议。我真的很感激。
  • 没问题。祝你好运。

标签: ios cocoapods podspec


【解决方案1】:

我相信您正在尝试通过 CocoaPods Specs 将您的 Count Down 添加为公共 pod?太棒了,方法如下。

目前这是一个手动过程(来自docs

  • 在本地克隆 CocoaPods/Specs。
  • 在一次提交中,将 Pod 的文件夹添加到主列表中,并按照创建 Pod 存储库部分中描述的格式添加 Spec。
  • 运行pod spec lint 以检查错误。
  • 如果 linter 产生错误或警告,请修复它们并返回第 3 步。如果没有,请继续。
  • 将您的pull request 设为主Specs Repo

但在 CocoaPods 0.33 的未来版本中,您应该可以使用新的 pod trunk 命令轻松完成此操作。

【讨论】:

  • 谢谢!我终于毫无错误地制作了 podspec 并提出了 Pull Request!
猜你喜欢
  • 2013-12-16
  • 2016-05-14
  • 2013-10-11
  • 2013-10-25
  • 2013-03-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多