10

I am trying to create my first pod again. I have tried this long ago, 1 year back I remember, that time also I got similar error.

Following code shows how my project.podspec file looks like, I don't know what I miss in here, CocoaPods just literally yelling at me, saying that there are some problems in podspec file.

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

I have no idea how this even works, when I run pod trunk push --allow-warnings, I get this error.

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.

Let me know your thoughts, Am I doing something wrong? Do I miss something?

And some other things that might be helpful. The git repo has same 0.1.0 tag.

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

Thank You guys in advance.

Samuel Peter
  • 4,136
  • 2
  • 34
  • 42
  • For the source: `https://github.com/alvinvarghese/MyProject.git` instead of `https://github.com/alvinvarghese/MyProject` ? – Larme May 24 '16 at 09:10
  • @Larme Sorry, that was a typing mistake when I writing the question. Actually it has suffix .git in podspec file. Thanks for pointing it out, I have updated the question. –  May 24 '16 at 09:12
  • Does your github repo have a "0.1.0" tag ? – Samuel Peter May 24 '16 at 10:03

1 Answers1

7

It seems that you forgot to include a source_files definition (or vendored_frameworks if you are making a closed-source pod). You should add a line like the following to your podspec :

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

See this for an example of a minimal working podspec.

Samuel Peter
  • 4,136
  • 2
  • 34
  • 42
  • Let me check that, give me a sec. –  May 24 '16 at 10:11
  • - ERROR | [iOS] file patterns: The `source_files` pattern did not match any file. - ERROR | [iOS] file patterns: The `public_header_files` pattern did not match any file. –  May 24 '16 at 10:14
  • The "ExampleLib" you mean here should be replaced with my pod name right? Thats what I did, same error. –  May 24 '16 at 10:17
  • It should be a pattern that matches where your files are relative to the root of the repo. The syntax reference for `source_files` is here : https://guides.cocoapods.org/syntax/podspec.html#tab_source_files. Also see my updated answer – Samuel Peter May 24 '16 at 10:19
  • Yeah I think this solved the problem related to podspec file, Now something's up with something. Telling me to add a new issue in GitHub CocoaPods. –  May 24 '16 at 10:22
  • I had a look but it didn't ring any bells, sorry... I do think however that you should include your complete podspec file in the issue along with the complete command line you ran, and from which directory you ran it. – Samuel Peter May 24 '16 at 11:33
  • or maybe you used backslashes instead of forward slashes ? – Samuel Peter May 24 '16 at 11:42
  • No, I don't think so. I have updated the issue in CocoaPods in Github. Please check. https://github.com/CocoaPods/CocoaPods/issues/5399 –  May 26 '16 at 09:12
  • s.source_files = 'MyLib/Classes/**/*' => ERROR, but s.source_files = 'MyLib/**/* => OK.' – Maxim Firsoff Aug 29 '16 at 18:40