Lord Vermillion Lord Vermillion - 3 years ago 483
Swift Question

Alamofire invalid value around character 0

Alamofire.request(.GET, "url").authenticate(user: "", password: "").responseJSON() {
(request, response, json, error) in


This is my request with Alamofire, for a certain request it sometime works, but sometimes i get:

Optional(Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.) UserInfo=0x78e74b80 {NSDebugDescription=Invalid value around character 0.})

I've read that this can be due to invalid JSON, but the response is a static json string that i have validated in JSON validator as valid. It does contain å ä ö characters and some HTML.

Why am i getting this error sometimes?

Answer Source

i also faced same issue i tried responseString instead of responseJSON and it worked .i guess this is bug in alamofire with using it with django .

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download