【发布时间】:2014-06-14 13:26:31
【问题描述】:
我在使用 AFNetworiking 2 的请求时遇到问题。
我的 sharedInstance 类方法中有我的 AFHTTPSessionManager 自定义 sharedInstance
sharedInstance.responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:3];
sharedInstance.responseSerializer.acceptableContentTypes = [sharedInstance.responseSerializer.acceptableContentTypes setByAddingObject:@"text/plain"];
sharedInstance.responseSerializer.acceptableContentTypes = [sharedInstance.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
这是因为我的服务器以文本/纯文本响应(仅在错误时 - 成功时它以 json 响应)
但即使我发送 POST 方法时,我也会收到此错误:
failure: error: Error Domain=NSCocoaErrorDomain Code=3840
"The operation couldn’t be completed. (Cocoa error 3840.)"
(JSON text did not start with array or object and option to allow fragments not set.)
UserInfo=0x175e6970 {NSDebugDescription=JSON text did not start with array or object
and option to allow fragments not set., NSUnderlyingError=0x175e59b0 "Request failed:
internal server error (500)"}
【问题讨论】:
标签: ios objective-c ios7 afnetworking-2