What are the eight life cycle hook functions of Vue>>>
AFN network request reported an error, error domain = nscocoaoerrordomain code = 3840 “invalid value around character 162.” userinfo = {nsdebugdescription = invalid value around character 162.}
When I use the online HTTP post/get… Interface test tool to test on the Internet, I have data and do not report an error
Solution:
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
Cause of error:
The format of the data transferred by the interface mentioned above and the data returned by the background are in JSON format. The format of the parameters transferred is as follows: {“listid”: “1”, “date”: “20190820”}. Therefore, the requestserializer and responseserializer are set to
AFJSON***Serializer
//Declare that the result returned is a JSON type
manager.responseSerializer = [AFJSONResponseSerializer serializer];
//Declare that the requested data is a JSON type
manager.requestSerializer = [AFJSONRequestSerializer serializer];
The format of parameter transfer is listid = 1 & amp; Date = 20190820, and the returned data format is binary data, so it should be changed to:
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
If the return is in JSON format, it should be adjusted according to the actual situation
Similar Posts:
- Python: json:json.decoder.JSONDecodeError: Invalid control character at: line 2 column 18 (char 19)
- Using Vue + Axios: axios.post error: request failed with status code 400 is one of the solutions
- Python JSON error json.decoder.jsondecodeerror Chinese
- [Solved] TypeError: string indices must be integers, not str
- Solve the problem of “resource interpreted as document but transferred with MIME type application / JSON” in IE browser
- [How to Solve] Failed to convert value of type ‘java.lang.String’ to required type ‘java.util.Date’;
- TypeError: Object of type ‘datetime‘ is not JSON serializable [Solved]
- Processing method of JSON error ‘XXX is not JSON serializable’
- Postman reported an error unsupported media type [How to Solve]