Search code examples
iphoneiosnsurlconnectionios6

sendAsynchronousRequest got Timeout Error on iPhone


My App allows user to take photo and upload it to a PHP server. I use sendAsynchronousRequest calls to send data (form with photo files) to the server. All those calls are working just fine on my iPad 2 when debugging. But when I debugged it on iPhone 4S, some of them get errors with error code, -1001, which represents Timeout error. I tried for thousand times in the past two days to find its root cause, but I still can't find one.

Has anybody encounters similar situation? or knows why?

The only clue I got is that if there are more than one file in the request data (original photo file and resized thumb file), it will receive time out error. Is it about request (photo file) size? or file number?


Solution

  • I solved the problem. It caused by upload big size file. The original photo token by iPhone 4s is about 5M big. If the network is not fast enough, the connection will be time out.