SessionUploadTask auto resend data after a period of time

Hi,


I setup a background session and started an upload task to upload a JSON file approximately 18MB. The task was able to send all bytes to server. However, server took its precious time (> 2 min) before responding to client. Before server responded to the upload task, the upload task automatically re-send the bytes to server again.


Is this behavior normal? Is there any configuration that can be set on in the NSURLSessionConfiguration or NSURLSessionUploadTask that can prevent the task from automatically resending data to server before receiving response?


Any kind of help would be much appreciated.


Thanks!

Replies

It sounds like the client timed out while waiting for the server to generate its response. Have you tried tweak the

timeoutIntervalForRequest
property on the session configuration you use to create the session? The default is 60 seconds, which seems like it’d cause you problems.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"