Unreliable order in IBOutletCollection within storyboard files

Originator:defagos
Number:rdar://12121242 Date Originated:17-Aug-2012
Status:Duplicate Resolved:
Product:iOS SDK Product Version:5.1
Classification:Serious bug Reproducible:Always
 
Summary:

When binding items of an IBOutletCollection NSArray within a xib file, if you bind a view A before a view B in Interface Builder, then A always ends up prior to B in the NSArray when accessed programmatically. This is not the case for IBOutletCollections bound within storyboard files, for which this order is unreliable.

Steps to Reproduce:

1) Test the behaviour for xib files (correct)
- create an application with a single view controller and an IBOutletCollection(Label) array
- use a xib to layout the view controller. Drop two labels 'A' and 'B' and bind them to the outlet collection, 'A' first, then 'B'
- log the collection contents in -viewDidLoad
- run the application several times, cleaning your project and removing the app between runs. 'A' will always appear before 'B' in your logs, even after several runs

2) Test the behaviour for storyboard files (incorrect)
- create an application using storyboards
- drop a view controller onto the storyboard, and add corresponding source files exposing an IBOutletCollection(Label)
- drop and bind two labels 'A' and 'B' onto the view controller in the storyboard file and bind them to the outlet collection, 'A' first, then 'B'
- log the collection contents in -viewDidLoad
- run the application several times, cleaning your project and removing the app between runs. 'A' will sometimes appear before 'B' in your logs, sometimes after

Expected Results:

For 2), 'A' always appears before 'B' in the logs (the order in which outlets were bound in the storyboard), in agreement with the predictable behaviour exhibited by 1)

Actual Results:

The order of the outlets in the collection is unreliable when accessed programmatically

Regression:

-

Notes:

Tested with Xcode 4.4 - iOS 5.1 and Xcode 4.5 DP4 - iOS 6

Comments

Duplicate of bug 11131849


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!