Alamofire.request(.GET, "url").authenticate(user: "", password: "").responseJSON() {
(request, response, json, error) in
println(error)
println(json)
}
这是我对Alamofire的请求,对于某个请求,它有时会起作用,但有时我会收到:
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验证器中验证该字符串是有效的.它确实包含Salesäö字符和一些HTML.
为什么我有时会收到这个错误?