NSURLSessionUploadTask - stops uploading after sending 160kB of data (5x 32kB chunks)
NSURLSessionUploadTask - stops uploading after sending 160kB of data (5x 32kB chunks)
- Subject: NSURLSessionUploadTask - stops uploading after sending 160kB of data (5x 32kB chunks)
- From: Robert Vojta <email@hidden>
- Date: Tue, 10 Dec 2013 20:16:32 +0100
Hi all,
I’ve got issues with NSURLSessionUploadTask and maybe I missed something. My NSURLSession has background configuration, cellular data allowed and discretionary property set to NO. The configuration is …
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:PLBackgroundURLSessionID];
configuration.allowsCellularAccess = YES;
configuration.discretionary = NO;
... in other words, it should upload immediately (if not created in the background where discretionary is forced to YES, but that’s not the case now).
When I’m testing it, it starts upload almost immediately, I see it in logs and then it suddenly stops after 160kB of data sent and is stalled ...
Task 2 did send data - sent: 32768 total sent: 32768 expected total: 1611384
Task 2 did send data - sent: 32768 total sent: 65536 expected total: 1611384
Task 2 did send data - sent: 32768 total sent: 98304 expected total: 1611384
Task 2 did send data - sent: 32768 total sent: 131072 expected total: 1611384
Task 2 did send data - sent: 32768 total sent: 163840 expected total: 1611384
… after few minutes, it starts uploading from scratch again (same task identifier, same messages in log with same numbers). And upload never finishes. Stalled again, … Nothing in console.
When I try to upload smaller files (< 160kB), they’re uploaded and all delegate methods are called, … But when the file size is > 160kB, it never finishes. Even after 10, 15, 20, … minutes. No completion method called, no error in console, nothing, it’s just stalled and it start again after few minutes.
When I’m testing this, app is started from Xcode and is active from the same beginning, no background entering, no incoming calls, active from the start.
When I create normal session configuration (not background), everything does work like a charm. But when I switch to background one, behavior is pretty weird.
Application delegate method (handleEventsForBackgroundURLSession:) implemented, all NSURLSessionDelegate, NSURLSessionDataDelegate, NSURLSessionUploadTaskDelegate and NSURLSessionTaskDelegate as well. In every method, first line is log statement. Nothing in logs.
Pretty puzzled to be honest and have no idea what’s going on here. Did anyone experience similar issues? An idea what can be wrong?
It behaves in the same way on all iOS 7.x versions (on beta as well). All devices, tested on 4S -> 5S. Simulator,
R.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden