I've a trouble with requests using AFNetworiking 2.
I have my AFHTTPSessionManager custom sharedInstance in my sharedInstance class method
sharedInstance.responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:3];
sharedInstance.responseSerializer.acceptableContentTypes = [sharedInstance.responseSerializer.acceptableContentTypes setByAddingObject:@"text/plain"];
sharedInstance.responseSerializer.acceptableContentTypes = [sharedInstance.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
This is because my server responds with text/plain (only on errors - on success it responses with jsons)
But even that when I send a POST method, I get this error:
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)"}
I've read questions: this and this and some more stuff in the web but there is no good answer. Any ideas?