我是Swift的新手,我开始使用PHP服务器开发Swift 4项目。我将Alamofire用于请求,并使用来打印数据print()
。这就是我得到的:
{"error":false,"n":"Raghad"}
但是,当我想将其转换为字符串时,它返回""
(空),当我转换为布尔值时,它正确地返回值。
那么,我该如何解决呢?
let wJSON : JSON = JSON(response.result.value!)
print(wJSON["n"].stringValue)
print(wJSON["error"].boolValue)
我将更responseString
改为responseJSON
Alamofire.request(Url !,方法:.post,参数:par).validate()。responseJSON
{如果在response.result.isSuccess中进行响应{让wJSON:JSON = JSON(response.result.value!)
这是工作
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句