1

我正在尝试为我的项目设置 podspec,但我在运行时不断收到此错误pod spec lint

➭ pod spec lint

 -> BRECBathroomFinder (1.0.0)
    - ERROR | [iOS] Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - ERROR |  BRECBathroomFinder/BRECBathroomFinder/BBFOpenDataClient.swift:16:26: error: use of undeclared type 'AFHTTPRequestOperationManager'
    - ERROR | [iOS]  BRECBathroomFinder/BRECBathroomFinder/BBFOpenDataClient.swift:29:73: error: use of undeclared type 'AFHTTPRequestOperation'
    - ERROR | [iOS]  BRECBathroomFinder/BRECBathroomFinder/BBFOpenDataClient.swift:48:35: error: use of undeclared type 'AFHTTPRequestOperation'
    - NOTE  | [iOS]  }, failure: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in
    - ERROR | [iOS]  BRECBathroomFinder/BRECBathroomFinder/BBFOpenDataClient.swift:29:9: error: 'BBFOpenDataClient' does not have a member named 'GET'

Analyzed 1 podspec.

这是我的 podspec。你会在底部注意到我的 I've got .prefix_header_contents = "#import <AFNetworking/AFNetworking.h>"in there;所以它找不到 AFHTTPRequestOperation 类对我来说没有意义。

Pod::Spec.new do |s| 
  s.name = "BRECBathroomFinder"
  s.version = "1.0.0"
  s.summary = "A pod that finds nearby BREC parks with restrooms"
  s.description = <<-DESC
                  This is a project built on top of Baton Rouge's Open Data API. It uses a query to find parks with bathrooms.

                  The results can be sorted according to how close the parks are to a given location or the user's location.
                  DESC
  s.homepage = "https://github.com/jmhooper/BRECBathroomFinder"
  s.author = { "Jonathan Hooper" => "jon9820@gmail.com"  }
  s.license = 'MIT'
  s.source = { git: "https://github.com/jmhooper/BRECBathroomFinder.git", tag: s.version.to_s }
  s.platform = :ios, '8.0'
  s.requires_arc = true
  s.source_files = "BRECBathroomFinder/**/*"
  s.dependency "AFNetworking", "~> 2.0"
  s.frameworks = "CoreLocation"
  s.prefix_header_contents = "#import <AFNetworking/AFNetworking.h>"
end
4

1 回答 1

4

在经历了很多挫折之后,我终于想通了。

在它抱怨的文件中,我不得不import AFNetworking在其余的 Swift 导入中添加一行。

我这样做了,并且 podspec 通过了验证。

于 2015-03-22T04:43:43.827 回答