false h2>
when using AFNetworking POST to connect to WEB API, error:
“The operation couldn’t e completed. (Cocoa error 3840).”
Error Domain=NSCocoaErrorDomain Code=3840 “The operation couldn’t be completed. (Cocoa Error 3840.)” (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x1667f670 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
solution
this is a JSON parsing error, which in general is probably caused by the incorrect format of the JSON data returned by your WEB API.
therefore, make sure that the return value of the WEB API is in the correct and valid JSON format. You can check with the following online JSON validation tool.
recommendation article: network requests and various error Code summary (Errors Code)
Read More:
- ios Cocoa error 4097
- 209151; org.json.JSONException A JSONObject text must begin with'{‘at character 1 of {
- Exception jsonmappingexception: out of start_ ARRAY token
- Python’s json.loads Invalid control character
- After verifying parameters with validation, springboot reports an error: no constructor found in package name + class name
- Error: required request body is missing, @ requestbody annotation usage
- Tensorflow error record: depreciation warning: elementwise
- Error: syntax error – unexpected token P in JSON at position 0
- (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)‘)))
- [comment: httpmessagenotreadableexception: JSON parse error: invalid UTF-8 start byte 0xa0]
- Determining IP information for eth0… failed; no link present. Check cable?
- Spring MVC 406 status code / could not find acceptable representation
- Error inflating class fragment error when loading custom fragment with fragment (valid)
- can’t set headers after they are sent
- Four ways to get Django parameters in request
- Error parsing XML: error after document element
- Router DIO network request: dioerror[ DioErrorType.RESPONSE ]: HTTP status error [400] or [500]
- JavaScript summary: the difference between typeof and instanceof, and Object.prototype.toString() method
- In pandas, dataframe and np.array The mutual transformation between the two