Alvin Varghese Alvin Varghese - 6 months ago 59
iOS Question

Cocoapods spec did not pass validation in an iOS project

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.

Answer

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.