Alamofire字符0周围的值无效 [英] Alamofire invalid value around character 0
本文介绍了Alamofire字符0周围的值无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Alamofire.request(.GET, "url").authenticate(user: "", password: "").responseJSON() {
(request, response, json, error) in
println(error)
println(json)
}
这是我对Alamofire的请求,对于某个时间段的某个请求有效,但有时我得到:
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.})
我读过这可能是因为JSON无效,但响应是静态json字符串我在JSON验证器中验证为有效。它包含åäö字符和一些HTML。
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?
推荐答案
我也面临同样的问题我尝试使用responseString而不是responseJSON并且它有效。我猜这是使用它的alamofire中的错误与django。
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 .
这篇关于Alamofire字符0周围的值无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文