抓我的头,继续得到额外的争论'方法'在通话中,我提出的所有数据都是正确的
ratingStar
是双数据类型
// Global Variable
reviewDriverEndPoint = "www.mywebsite.com/api/review"
func reviewDriver() {
let parameters: [String: AnyObject] = [
"star": ratingStar as AnyObject,
"comment": reviewBox.text as AnyObject,
]
Alamofire.request(reviewDriverEndPoint, method: .post, parameters: parameters, encoding: JSONEncoding.default)
.responseJSON { response in
if let value = response.result.value {
print(value)
}
}
}
答案 0 :(得分:0)
Alamofire的方法不知道您是否将变量或函数作为参数传递,因此它使用最近的本地名称(在您的情况下为函数)。
您必须更改功能名称或变量,如
reviewDriverEndpoint = "www.mywebsite.com/api/review"
func reviewDriver() {
let parameters: [String: AnyObject] = [
"star": ratingStar as AnyObject,
"comment": reviewBox.text as AnyObject
]
Alamofire.request(reviewDriverEndpoint, method: .post, parameters: parameters, encoding: JSONEncoding.default)
.responseJSON { response in
if let value = response.result.value {
print(value)
}
}
}