16

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?
4

3 回答 3

14

最近我遇到了这个问题并添加--allow-warnings修复了这个问题。

pod spec lint MyProject.podspec --allow-warnings
于 2015-03-31T07:39:04.113 回答
8

好的。从 Cocoapods 的家伙那里得到了我的回答。Podspec 验证在所有错误和警告上都失败。警告失败并不意味着项目作为 Pod 失败。结果我可以简单地忽略警告。

至于 AFNetworking,该问题已在 2.0 版中得到解决。

于 2013-10-08T14:32:48.933 回答
0

[更新]

按照 cocoapods 指南配置您的 podspec 文件并在验证时解决错误,如果您只收到警告并且只想忽略它,那么可以通过运行以下命令来完成。

使用警告验证 podspec

最后添加--allow-warnings它将强制验证 podspec。

pod spec lint your_project_name.podspec --allow-warnings

推送带有警告的 podspec 存储库

确保您已添加您的 repo,如果没有运行以下命令(如果您已经添加,请忽略它)

pod repo add your-pods pods_git_url

对于 Pushing podspec to repo 使用这个

pod repo push your-pods your_project_name.podspec --allow-warnings
于 2019-09-02T08:34:13.690 回答