0

我正在尝试在 Swift 中提交 JSON-RPC 请求,并且我正在遵循此(在 iOS Swift 中执行 POST 请求)指南。

不幸的是,我无法通过这样做将答案的“结果”部分转换为 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\"}]";}
4

1 回答 1

0

正如 Hot Licks 和 Martin R 所指出的,这确实是一个服务器端问题。

于 2015-03-19T19:26:53.003 回答