w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
AFNetorking in Swift project -- "Error: Request failed: unacceptable content-type: text/html"

You have to add content-type allowed for the response.

You could do that for json content :

 manager.responseSerializer.acceptableContentTypes =
NSSet(objects: "application/json")


If you're using AFNetworking 2.0, from AFNetworking wiki :

"By default, AFHTTPRequestOperationManager and AFHTTPSessionManager have JSON serializers."

So you should maybe try to change the response serializer in your manager like this :

manager.responseSerializer = AFHTTPResponseSerializer()

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.