0

Here is the content I need to download to my app.

This is how I request this:

GET("identifiers/pl-normal.json", parameters: nil, progress: nil, success: { sessionDataTask, response in


    }) { sessionDataTask, error in
        completionBlock(error)
}

URL Request is correct: GET Optional(http://www.taboo.blue-world.pl/api/identifiers/pl-normal.json)

but the failure block is called, why?

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

1 Answers1

0

The error block will be called in AFNetworking if results of the network request cannot be parsed properly. In other words, this is a serialization error. It looks like the content you are getting is not properly formatted json. Run your server response through a json linter and make sure it is valid, and you should be all set.

If that doesn't work, try adding text/html as an acceptable content type in your serializer, as described here - Request failed: unacceptable content-type: text/html using AFNetworking 2.0

Community
  • 1
  • 1
Alex Chase
  • 960
  • 1
  • 7
  • 11