title: iOS 8 - NSProgress object with fractionCompleted = 1.0 created by NSURLSessionDownloadTask before even resuming the task
body: <p>I have a tree of NSProgress objects to monitor data processing which involves downloading files. Downloading is done using NSURLSession with background configuration.</p>
  
  <p>When I start the process, the topmost NSProgress object reports unexpected fractionCompleted figures. Having debugged the issue (and isolating it into a "Hello World" application), 
  I found that an NSProgress object is created as a result of calling [NSURLSession downloadTaskWithRequest:] and its fractionCompleted property is 1.0 right after calling the above method.
  Since this NSProgress object gets part of my NSProgress tree, if offsets the progress figures above it in the tree.</p>
  
  <p>In this sample application, I am also starting a dummy background task parallel with the download, which reports progress through an NSProgress object. 
  The reason why I did so is that provided that NSURLSession does not create any NSProgress objects (, which is what Apple claims) there will still be at least one down in the NSProgress tree.</p>
  
  <p>Having logged the NSProgress tree right after launching the download and the dummy task here is what the NSProgress tree looks like:</p>
  
  <pre><code>&lt;NSProgress: 0x7ff8dae06b10&gt; : Parent: 0x0 / Fraction completed: 0.5000 / Completed: 0 of 1  
    &lt;_NSProgressGroup: 0x7ff8dae0f450&gt; : Portion of parent: 1 Children: 1
      &lt;NSProgress: 0x7ff8dae0f880&gt; : Parent: 0x7ff8dae06b10 / Fraction completed: 0.5000 / Completed: 0 of 100  
        &lt;_NSProgressGroup: 0x7ff8dae0fec0&gt; : Portion of parent: 100 Children: 2
          &lt;NSProgress: 0x7ff8dad74b90&gt; : Parent: 0x7ff8dae0f880 / Fraction completed: 1.0000 / Completed: 1 of 1  
          &lt;NSProgress: 0x7ff8daf036c0&gt; : Parent: 0x7ff8dae0f880 / Fraction completed: 0.0000 / Completed: 0 of 100
  </code></pre>
  
  <p>As a result, progress reporting gets weird.</p>
  
  <p>If I comment out the call to start the download ([self resumeDownload]) then the NSProgress tree looks like:</p>
  
  <pre><code>&lt;NSProgress: 0x7febca52ac90&gt; : Parent: 0x0 / Fraction completed: 0.0000 / Completed: 0 of 1  
    &lt;_NSProgressGroup: 0x7febca529e60&gt; : Portion of parent: 1 Children: 1
      &lt;NSProgress: 0x7febca529ff0&gt; : Parent: 0x7febca52ac90 / Fraction completed: 0.0000 / Completed: 0 of 100  
        &lt;_NSProgressGroup: 0x7febca52ced0&gt; : Portion of parent: 100 Children: 1
          &lt;NSProgress: 0x7febca52d780&gt; : Parent: 0x7febca529ff0 / Fraction completed: 0.0000 / Completed: 0 of 100
  </code></pre>
  
  <p>As you can see there is no extra NSProgress object with fractionCompleted = 1.0 and the progress reporting is OK.</p>
  
  <p>Now I do not see where that NSProgress with fractionCompleted = 1.0 is coming from if it is not from NSURLSession or something underneath. (Apple stated that NSURLSession does not create NSProgress objects.)
  I cannot see this behaviour on iOS 7 only on iOS 8 (even with the GM release).</p>
  
  <p>Please note that I am using NSURLSession with background configuration! With default configuration the issue is not present.</p>
  
  <p>Why does that "unexpected" NSProgress object appear with fractionCompleted = 1.0?
  Am I using the NSProgress API wrong?
  What's causing the very different behaviour on iOS 7 and 8?</p>
  
  <p>The sample code is available here: <a href="https://s3-eu-west-1.amazonaws.com/pg.test/pubtest/NSProgress-20140830.zip" rel="nofollow">https://s3-eu-west-1.amazonaws.com/pg.test/pubtest/NSProgress-20140830.zip</a></p>
  
  <p>Thank for any help in advance.</p>