繁体   English   中英

Swift 2-通话中有其他参数

[英]Swift 2 - Extra argument in call

我创建了一个错误处理类,该类旨在简化我的调用,但是我Extra limit argument in call不断收到错误Extra limit argument in call 我已经仔细检查了它们都是7个参数,我怎么会得到这个错误?

class GetOrganization {

  func request(
  lastPage: Int?,
  limit: Int,
  location: CLLocation,
  radius: Int?,
  success successCallback: (JSON) -> Void,
  error errorCallback: (statusCode: Int) -> Void,
  failure failureCallback: (error: Error) -> Void
  ) {


      Provider.request(.Organizations(lastPage, limit,location.coordinate.longitude, location.coordinate.latitude, radius)) { result in
          switch result {
          case let .Success(response):

              do {
                  try response.filterSuccessfulStatusCodes()

                  let json = try JSON(response.mapJSON())
                  successCallback(json)


              }
              catch {
                  errorCallback(statusCode: response.statusCode)
              }



          case let .Failure(error):
              failureCallback(error: error)

          }
      }
  }

}

*我得到错误的地方**

    GetOrganization.request(
            lastPage: lastPage,
            limit: limit,
            location: location,
            radius: nil,
            success: { data in

                }, error: { err in
                    print(err)
                }, failure: { faillure in
                    // oh well, no network apparently
    })

它不是静态函数,因此不能像GetOrganization.request那样调用它。 可以将func request设置为static func request也可以创建一个对象并通过该对象访问它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM