Afnetworking 2.0 has been available for a long time. The new version was rewritten again and made a lot of changes. It is also very convenient to use. But there are some problems with using it at some point. For example, when requesting the background data, the JSON data should be returned, but the printing gets the wrong information hint:request failed:unacceptable content-type:text/html ErrorCode =- 1016.
Most of the answers on the Web are:
/// /// practices before AFN2.0 [Afjsonrequestoperation addacceptablecontenttypes:[nsset Setwithobject:@ "text/html" ]]; /// ///
Afnetworking 2.0 How to modify, in fact, can be inspired by 1.0, but the position has changed.
// // /// The practice for AFN2.0 in afurlresponseserialization.m modify the following, add text/html can. self.acceptablecontenttypes = [Nsset setwithobjects:@ "application/json"@ " Text/json"@"text/javascript"@"text/ HTML", nil]; ////
Afnetworking 2.0-1016 Error Resolution