Podspec 验证错误 - 文件模式:规范为空

Podspec validation error - File Patterns: The spec is empty

我正在尝试再次创建我的第一个 pod。我很久以前就试过这个,我记得一年前,那次我也遇到了类似的错误。

下面的代码显示了我的 project.podspec 文件的样子,我不知道我在这里错过了什么,CocoaPods 只是字面上对我大喊大叫,说 podspec 文件.

Pod::Spec.new do |s|
  s.name = 'MyProject'
  s.version = '0.1.0'
  s.platform = :ios, '9.0'
  s.license = 'MIT'
  s.summary = 'Something Blah Blah'
  s.homepage = 'https://github.com/alvinvarghese/MyProject'
  s.author = { 'Alvin Varghese' => 'my email' }
  s.source = { :git => 'https://github.com/alvinvarghese/MyProject.git', :tag => s.version.to_s }

  s.description = 'Blah Blah Blah BlahBlah BlahBlah BlahBlah BlahBlah Blah Blah Blah'      \
                  'Blah Blah'
  s.frameworks = 'UIKit', 'Foundation'
  s.social_media_url = 'https://twitter.com/aalvinv'
  s.ios.deployment_target = '9.0'
  # s.resource_bundles = {
  #   'dummy' => ['dummy/Assets/*.png']
  # }

  s.public_header_files = 'Pod/Classes/**/*.h'
  s.frameworks = 'UIKit', 'Foundation'
  # s.dependency 'AFNetworking', '~> 2.3'

end

我什至不知道这是如何工作的,当我 运行 pod trunk push --allow-warnings 时,我得到了这个错误。

Alvin-The-Robot:MyProject Alvin$ pod trunk push --allow-warnings

[!] Found podspec `MyProject.podspec`
Updating spec repo `master`
Validating podspec
 -> MyProject (0.1.0)
    - ERROR | [iOS] File Patterns: The MyProject (0.1.0) spec is empty (no source files, resources, resource_bundles, preserve paths, vendored_libraries, vendored_frameworks, dependencies, nor subspecs).
    - ERROR | [iOS] unknown: Encountered an unknown error (The `MyProject` pod failed to validate due to 1 error:
    - ERROR | [iOS] File Patterns: The MyProject (0.1.0) spec is empty (no source files, resources, resource_bundles, preserve paths, vendored_libraries, vendored_frameworks, dependencies, nor subspecs).

) during validation.

[!] The spec did not pass validation, due to 2 errors.

让我知道你的想法,我做错了什么吗?我错过了什么吗?

以及其他一些可能有用的东西。 git 存储库具有相同的 0.1.0 标签。

Alvin-The-Robot:MyProject Alvin$ git tag
0.1.0

提前谢谢大家。

您似乎忘记包含 source_files 定义(或者 vendored_frameworks 如果您正在制作闭源 pod)。您应该在 podspec 中添加如下一行:

s.source_files = "MyProject/**/*.{h,m}"

有关最小工作 podspec 的示例,请参阅 this