Snažím sa predložiť žiadosť JSON-RPC v spoločnosti Swift a ja som ju nasledoval ( Vykonajte požiadavku POST v systéme iOS Swift ).
Bohužiaľ, nedokážem odovzdať výslednú časť odpovede NSDictionary takto:
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)")
}
}
kde responseObject je AnyObject.
Môj objekt odpovede vyzerá takto:
{
id = 1;
jsonrpc = "2.0";
result = "[{"ID":11,"Name":"MyName","LLogon":"2015-03-16T13:04:14"}]";}
odpovede:
0 pre odpoveď č. 1Ako uviedli Hot Licks a Martin R, toto bolo naozaj serverovým problémom.