【发布时间】:2015-10-01 04:05:12
【问题描述】:
我今天正在更新我的 Swift 2.0 代码,但是这条线
var json = JSON(json) 给我以下错误
无法使用类型参数列表调用类型“JSON”的初始化程序 (结果)
你们知道我应该如何更改我的代码吗?
@IBAction func changePassword(sender: UIBarButtonItem) {
Alamofire.request(.POST, AppDelegate.kbaseUrl + "users/me/password", parameters: ["old_password": self.oldPasswordTextField.text!, "new_password": self.newPasswordTextField.text!, "confirm_password": self.confirmPasswordTextField.text!], encoding: .JSON)
.responseJSON {
(req, res, json) in
var json = JSON(json)
if json["meta"]["status"]["code"] == 200 {
self.navigationController?.popViewControllerAnimated(true)
}
let alert = UIAlertView(title: json["meta"]["msg"]["subj"].stringValue, message: json["meta"]["msg"]["body"].stringValue, delegate: nil, cancelButtonTitle: "Close")
alert.show()
}
}
【问题讨论】:
标签: ios swift swift2 alamofire swifty-json