NSProgress can't implicitly add multiple children in iOS 9.0

Originator:unho86
Number:rdar://23428280 Date Originated:18-Nov-2015 01:01 AM
Status:Closed Resolved:Behaves correctly
Product:iOS SDK Product Version:9.0
Classification:Bug Reproducible:Always
 
Summary:
Instantiating more than 1 NSProgress (with progressWithTotalUnitCount:) 
between the becomeCurrentWithPendingUnitCount and resignCurrent 
does not make all instances children of the the current progress.

Steps to Reproduce:
  _mainProgress = [NSProgress progressWithTotalUnitCount:100];
    
    [_mainProgress becomeCurrentWithPendingUnitCount:100];

    for (int i=0; i<5; i++) {
        [self addChildProgress];
    }
    
    [_mainProgress resignCurrent];

Expected Results:
expected _mainProgress to have 5 children like in iOS 8 

<NSProgress: 0x7fe05248c750> : Parent: 0x0 / Fraction completed: 0.0000 / Completed: 0 of 100  
  <_NSProgressGroup: 0x7fe05248fcc0> : Portion of parent: 100 Children: 5
    <NSProgress: 0x7fe052519bf0> : Parent: 0x7fe05248c750 / Fraction completed: 0.0000 / Completed: 0 of 0  
    <NSProgress: 0x7fe05248fe50> : Parent: 0x7fe05248c750 / Fraction completed: 0.0000 / Completed: 0 of 0  
    <NSProgress: 0x7fe0524904e0> : Parent: 0x7fe05248c750 / Fraction completed: 0.0000 / Completed: 0 of 0  
    <NSProgress: 0x7fe052519a50> : Parent: 0x7fe05248c750 / Fraction completed: 0.0000 / Completed: 0 of 0  
    <NSProgress: 0x7fe052490070> : Parent: 0x7fe05248c750 / Fraction completed: 0.0000 / Completed: 0 of 0  


Actual Results:
same code on iOS 9.1 the main progress has only 1 child
<NSProgress: 0x7fa259d3d180> : Parent: 0x0 / Fraction completed: 0.0000 / Completed: 0 of 100  
  <NSProgress: 0x7fa259d406f0> : Parent: 0x7fa259d3d180 / Fraction completed: 0.0000 / Completed: 0 of 0 

all other 4 progress instances have the parent nil 

Version:
with iOS 8.4 an iOS 9.1

Notes:
Even though [NSProgress currentProgress] is always returning the _mainProgress as expected, using the - (instancetype)initWithParent:(NSProgress *)parentProgressOrNil userInfo:(NSDictionary *)userInfoOrNil
method and passing the [NSProgress currentProgress] the resulting progress still has the parent nil

Configuration:
iPhone 6 Simulator

Comments

Apple Developer Relations

Engineering has determined that this issue behaves as intended based on the following information:

This was an intentional change to help ensure that people could use NSProgress correctly. Check out the Foundation release notes for more information.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!