Contextual type for closure argument list expects 1 argument, but 4 were specified

前端 未结 2 1619
忘掉有多难
忘掉有多难 2020-12-10 12:47

I upgraded to Xcode 7 and I am using Alamofire to manage API calls and I am getting this error:

\'Contextual type for closure argument list expects 1 argument, but 4

2条回答
  •  伪装坚强ぢ
    2020-12-10 13:03

    The closure takes a single parameter of type Response so your code should look more like this.

    Alamofire.request(.POST, urlString, parameters: parameters).responseJSON { response in
        let json = JSON(response.data!)
        let token = json["token"].string
        response(token: token)
    }
    

提交回复
热议问题