Sometimes a network request with a afnet error can occur: Domain=com.alamofire.error.serialization.response error code=-1016
As shown in the following illustration:
Understand that the client cannot resolve the data returned by the service segment:
PS: digression, this problem is actually the background developers of the pot, did not do a good job return style)
A few years ago with ASI can parse the data, now with afnet, we need to manually add analytic format "text/html";
See some technical Bowen, to get into afnet source file afurlresponseserialization.m; This method is OK, but we try not to change the source code that has been formed, so we need to add it manually in the place where we use Afnet: Manager.responseSerializer.acceptab Lecontenttypes = [Nsset setwithobject:@ "text/html"]; Can
Shaped like:
Afhttprequestoperationmanager *manager = [Afhttprequestoperationmanager manager];
Manager.responseSerializer.acceptableContentTypes = [Nsset setwithobject:@ ' text/html '];//set the appropriate content type
[Manager Post:url Parameters:parameters success:^ (afhttprequestoperation *operation, id responseobject) {
} failure:^ (Afhttprequestoperation *operation, Nserror *error) {
}];