Alamofire.request(.GET, "url").authenticate(user: "", password: "").responseJSON() {
(request, response, json, error) in
println(error)
println(json)
}
Run Code Online (Sandbox Code Playgroud)
这是我对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.})
Run Code Online (Sandbox Code Playgroud)
我已经读过这可能是由于JSON无效,但是响应是一个静态json字符串,我在JSON验证器中验证为有效.它包含åäö字符和一些HTML.
为什么我有时会收到此错误?