Error Domain=NSCocoaErrorDomain Code=3840 “Invalid value around character 162.” UserInf…

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


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


//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: