Rens Verhage
Rens Verhage

Reputation: 5857

Podspec fails to pass validation, but no ERROR logged

I have some apps that are quite similar. Therefore, I'd like to create a or some private pod(s) containing all common reusable code. My first version contains some networking functionality that uses AFNetworking and also uses KeychainItemWrapper:

Pod::Spec.new do |s|

  s.name          = 'CommonLib'
  s.version       = '0.0.1'
  s.homepage      = '****'
  s.summary       = 'My Common lib'
  s.description   = 'Library with common code'
  s.author        = { "Rens Verhage" => "*****" }
  s.platform      = :ios, '5.0'
  s.source        = { :git => "ssh://****/CommonLib.git", :tag => s.version.to_s }
  s.source_files  = 'CommonLib/*.{h,m}'
  s.requires_arc  = true

  s.dependency 'AFNetworking', '~> 1.3.1'
  s.dependency 'KeychainItemWrapper', '~> 1.2'
end

Running pod spec lint CommonLib.podspec gives a couple of WARN and NOTE messages:

 -> CommonLib (0.0.1)
    - WARN  | Missing required attribute `license`.
    - WARN  | Missing license type.
    - NOTE  | [xcodebuild]  AFNetworking/AFNetworking/AFHTTPClient.h:84:9: warning: SystemConfiguration framework not found in project, or not included in precompiled header. Network reachability functionality will not be available. [-W#pragma-messages]
    - NOTE  | [xcodebuild]  AFNetworking/AFNetworking/AFHTTPClient.h:89:9: warning: MobileCoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available. [-W#pragma-messages]
    - NOTE  | [xcodebuild]  CommonLib/CommonLib/NSArray+NSArray_PerformSelector.m:19:35: warning: performSelector may cause a leak because its selector is unknown [-Warc-performSelector-leaks]
    - NOTE  | [xcodebuild]  CommonLib/CommonLib/NSArray+NSArray_PerformSelector.m:19:51: note: used here
    - WARN  | [iOS] Unable to find a license file

Analyzed 1 podspec.

[!] The spec did not pass validation.

Notice there are no ERROR messages, but the spec doesn't pass validation however. I don't really no where to go from here. The message that the SystemConfiguration and MobileCoreServices frameworks are missing looks like an error to me. I tried fixing this warning by adding

s.ios.frameworks = 'MobileCoreServices', 'SystemConfiguration'

to my podspec, but that doesn't work.

So, two questions in one:

  1. What is the error that keeps my podspec from passing validation?
  2. How can I fix the warning about missing frameworks?

Upvotes: 16

Views: 7147

Answers (3)

PRAVEEN
PRAVEEN

Reputation: 5895

[Updated]

Follow cocoapods guide to configure you podspec file and resolve the error if you are getting any and while validating it, If you are getting warnings only and if you just want to ignore it then yes you can do it by running following command.

Validating podspec with warnings

Add--allow-warningsat the end it will forcefully validate podspec.👇🏻

pod spec lint your_project_name.podspec --allow-warnings

Push podspec repo with warnings

Make sure that you have added your repo, if not run the following command (ignore it, if you have already added it)

pod repo add your-pods pods_git_url

For Pushing podspec to repo use this 👇🏻

pod repo push your-pods your_project_name.podspec --allow-warnings

Upvotes: 0

Josip B.
Josip B.

Reputation: 2464

Recently I had this problem and adding --allow-warnings fixes the issue.

pod spec lint MyProject.podspec --allow-warnings

Upvotes: 14

Rens Verhage
Rens Verhage

Reputation: 5857

Ok. Got my answer from the Cocoapods guys. Podspec validation fails on all errors and warnings. Failing on warnings doesn't mean the project fails as a Pod. Turns out I can simply ignore the warning.

As for AFNetworking, the issue has been resolved with version 2.0.

Upvotes: 8

Related Questions