[英]Swift 2 - Extra argument in call
I've created a error handling class, which is suppose to make my calls easier, however i keep getting an error Extra limit argument in call
. 我创建了一个错误处理类,该类旨在简化我的调用,但是我
Extra limit argument in call
不断收到错误Extra limit argument in call
。 I've double checked that their is 7 arguments in both, how come i get this error? 我已经仔细检查了它们都是7个参数,我怎么会得到这个错误?
Class 类
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)
}
}
}
}
*Where i get the 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
})
It is not a static function, so you can't call it like GetOrganization.request
. 它不是静态函数,因此不能像
GetOrganization.request
那样调用它。 Either set the func request
as static func request
or create an object and access it via that object. 可以将
func request
设置为static func request
也可以创建一个对象并通过该对象访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.