AFNetworking 2.0 - “unacceptable content-type: text/plain”

前端 未结 7 1788
深忆病人
深忆病人 2020-12-28 15:12

I\'m using AFNetworking 2.0 to read JSON from a service I\'m building (on localhost for now) in Node. Pretty normal stuff.

Node is sending JSON like so

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-28 15:40

    It seems that the server is sending "text/html", and this type is not supported by default. Add @"text/html" for "acceptableContentTypes"

    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    

提交回复
热议问题