ios - Request failed: unacceptable content-type: text/plain using AFNetworking 2.0 -


I have a trouble with the request using AFNetworiking 2.

I share my AFHTTPSessionManager customInstance in my shared inter class method

  shared instances Reactions Surgery = [AFJSNranspenceSyriaLizer SerializerWeaverWide Readings: 3]; SharedInstance.responseSerializer.acceptableContentTypes = [sharedInstance.responseSerializer.acceptableContentTypes setByAddingObject: @ "text / plain"]; SharedInstance.responseSerializer.acceptableContentTypes = [sharedInstance.responseSerializer.acceptableContentTypes setByAddingObject: @ "text / html"];  

That's because my server responds with text / plain (only on errors - responses with Jason on success)

But even so That whenever I send a post method, I get this error:

  Failure: error: error domain = NSCocoaErrorDomain code = 3840 ". The operation can not be completed (cocoa error 3840 .) "(Did not start with the JSON text array or the item and option pieces Not allowed to allow) UserInfo = 0x175e6970 {NSDebugDescription = JSON text array or object and pieces did not start with the option to allow, NSUnderlyingError = 0x175e59b0 "Request failed: Internal server error (500)".} .  

I have read the question: And there are more things in the web but there is no good answer. Any thoughts

try something like this:?

  AFHTTPSessionManager * Manager = [[AFHTTPSessionManager alloc] initWithBaseURL: [ns URL] URLWithString: url]]; Manager.responseSerializer = [AFJSONResponseSerializer serializer]; Manager.requestSerializer = [AFJSOnUrUt Certilizer Serializer];  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -