One, the error is handled in the interface contract.
Second, the error state may be incorrect.
The device is ambiguous to confirm that the operation is a cult failure. For example, a mobile app makes an HTTP request to transfer funds between two accounts. The request was received by the banking system and processed correctly; However, the Nsurlconnection report timed out because the network failure response was lost. The timeout occurred, but it happened after the transfer request was successful. If you retry the operation, it will result in a duplicate transfer, which may cause the user to overdraw.
Third, verify the load.
JSON and XML have a payload format for the validation mechanism, but the comma-separated value file and HTML do not have this mechanism.
Four, the separation of errors and normal business conditions.
Five, always check HTTP status.
Six, always check the value of Nserror.
Seven, use a consistent method to handle errors.
Eight, always set the time-out.
In iOS, the default supermarket time for HTTP requests is 4 points, which is too long for mobile apps. Most users will not wait 4 minutes in any app. Developers need to choose a reasonable time-out, in the way
Evaluate the possible response times for network requests, and then take into account the network latency under the worst-case network scenario.
Reference: "iOS network advanced programming-iphone and ipad Enterprise application Development"
"Reading notes" iOS network-rule of thumb for error handling