I am working on an app that uploads images to a server, and I am using background NSURLSessionUploadTask
s. This works perfectly for small numbers of uploaded images, such as 10 to 20 photos. However, I have been running into problems when trying to upload 100+ images at once. How scalable are background NSURLSessionUploadTask
s?
When I call
NSURLSessionUploadTask *task = [uploadSession uploadTaskWithRequest:request fromFile:fileURL];
repeatedly, it blocks waiting for a semaphore. Is this due to the round trip time communicating with the background upload daemon? Is it waiting for the background upload daemon to process the other upload tasks? With over 100 photos, I have seen these calls block for a total of over 40 seconds. Also, once these calls finish, it takes a while for uploads to make any progress, and they frequently stall for many seconds at a time.
I would love to be able to set up my 100+ upload tasks and sit back and let iOS 7 handle the uploads for me. However, if I have to, I can create the upload tasks just a few at a time. That seems like a shame with such an advanced background upload feature available in iOS 7. I might as well be using NSURLConnection
under iOS 6.
Thanks for your help.