我正在尝试在Swift中提交JSON-RPC请求,我正在关注此(Perform POST request in iOS Swift)指南。
不幸的是,通过这样做,我无法将答案的“结果”部分转换为NSDictionary:
if let responseDictionary = responseObject as? NSDictionary {
if let errorDictionary = responseDictionary["error"] as? NSDictionary {
println("error logging in (bad userid/password?): \(errorDictionary)")
} else if let resultDictionary = responseDictionary["result"] as? NSDictionary {
println("successfully logged in, refer to resultDictionary for details: \(resultDictionary)")
} else {
println("we should never get here")
println("responseObject = \(responseObject)")
}
}
其中responseObject是AnyObject。
我的回复对象如下所示:
{
id = 1;
jsonrpc = "2.0";
result = "[{\"ID\":11,\"Name\":\"MyName\",\"LLogon\":\"2015-03-16T13:04:14\"}]";}
答案 0 :(得分:0)
正如Hot Licks和Martin R所指出的,这确实是服务器方面的问题。