In the script, I write header('Content-Type: application/json; charset=utf-8'); , and the receiving party shouts Request failed: unacceptable content-type: image/jpeg ...

ps. I make a request through AFNetrowking. And from the same table (MySQL), some data comes with the correct header - others with jpeg ...

ADDED : copied the line in the database to another position with a different id ... and the correct header came! It turns out that the type of the header directly can somehow depend on a specific line in MySQL ??!

Also checked the request through the service http://checkmy.ru/?go=checkmy.ru comes correct Content-Type: application/json; charset=utf-8 Content-Type: application/json; charset=utf-8 ...

I made a request to support - the answer is "We are sending you a header with JSON" ...

Apparently something with the settings of the AFNetworking itself? How to make it accept JSON header?

    2 answers 2

    Try this:

     manager.responseSerializer = [AFJSONResponseSerializer serializer]; 

      And what about the server? Can a mime_magic type module be activated there, which tries to determine the mime type by the first bytes sent to the client?

      • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky
      • Who can faced a bug when AFNetworking starts the accepted json title to issue for Image / jpeg? Once again checked - the server gives the correct Json. - Chekist
      • And, I noticed that JSON comes on the simulator, and on the iPhone - image / jpeg! - Chekist