I’m utilizing NSURLSession with a background configuration to add a big file, and the server instantly returns one other giant file in the identical request (I can’t change the server habits). I solely use the delegate-based API uploadTaskWithRequest:fromFile: as a result of I would like the switch to proceed when the app is in background or killed. The issue: for this add job I by no means obtain URLSession:dataTask:didReceiveResponse:completionHandler: in my delegate, so I can’t return NSURLSessionResponseBecomeDownload and due to this fact can’t convert it right into a obtain job that streams to disk. I both find yourself with your complete response buffered in reminiscence (by way of didReceiveData) or with no technique to stream it as a file. Utilizing dataTaskWithRequest: does name didReceiveResponse, however information duties don’t proceed reliably in background for this use case. Is there any supported sample with NSURLSession that enables a background add of a giant file utilizing uploadTaskWithRequest:fromFile: whereas additionally streaming the big server response physique on to a file (not reminiscence) in the identical request?

