samedi 27 juin 2015

AFNetworking get responseObject in failure block

I am GET a json data from server, but the json data has a line break "\n", so i got the error:

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Unescaped control character around character 2333.) UserInfo=0x7fa054a02ab0 {NSDebugDescription=Unescaped control character around character 2333.}

So i want to find where's the broken json data, escape it first and then parse it. But i can't find where the response data is.

Any help?

Edited:

            if let d = error.userInfo  {
                    println(d)
         println(d[AFNetworkingOperationFailingURLResponseDataErrorKey])
                }

I tried this in failure block, d[AFNetworkingOperationFailingURLResponseDataErrorKey] prints nil

Aucun commentaire:

Enregistrer un commentaire