I built an app, more than an year ago, that provides photo sharing and video sharing for its users. It ran without any problems until a couple of weeks ago where I introduced a new feature: the possibility of marking a video to be uploaded only when WiFi is available: the video is set to use an NSURLSession with a NSURLSessionConfiguration where allowsCellular is set to NO.
Most of the time it works fine:
- I set a video to be share on WiFi while I'm connected through 3G/4G
- Once I connect to a WiFi network the video is uploaded without issues
However, some users, don't have their videos uploaded once they connect to WiFi. I got some logs from them and I can see an error whenever they connect to Wifi, for some reason NSURLSession makes the delegate call to:
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
With the following error:
Error: Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSErrorFailingURLStringKey=https://my-videos-bucket.s3.amazonaws.com/4074196678138134606/F17F7308-2810-4325-A5AF-BB8FFC093AC6.mov, NSURLErrorBackgroundTaskCancelledReasonKey=0, NSErrorFailingURLKey=https://my-videos-bucket.s3.amazonaws.com/4074196678138134606/F17F7308-2810-4325-A5AF-BB8FFC093AC6.mov}
Any ideas? Could it be a problem with the server? The odd thing is that I can't reproduce it nor understand the reason for failure
Thanks in advance!
Ze