NSURLSessionTask & ProgressReporting Parent/Children

Hi everyone,


We have a Use Case where we have to download multiple files to allow a user to consume their content offline, and we'd like to show overall download progress, using NSProgress.


I'm trying to use iOS 11's support for ProgressReporting directly from a URLSessionDataTask.


The problem I'm running into here is that NSProgress expects clients of its API to know the amount of total work each child represents upfront. This is before the URLSessionDataTask has had a chance to get a reply back from the network.


To get around this, I'm using KVO to wait until each individual URLSessionDataTask's Progress has a totalUnitCount set; and only add it as a child at that point.


I was wondering if there was any other techniques or ideas anyone that would be more elegant.


Thanks


Ronak

I just tried to use the 'progress' property but couldn't get any useful information from it, see https://stackoverflow.com/q/49088405/1623781

Yes, this property seems to be completely broken. Please open a bug report.

NSURLSessionTask & ProgressReporting Parent/Children
 
 
Q