Invalid storyboard segue reference causes ibtool failure with obscure error message

Originator:getaaron
Number:rdar://21262825 Date Originated:05-Jun-2015 01:30 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode Version 6.3.2
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
After git merging a .storyboard file, an invalid reference in the inferredMetricsTieBreakers section will make the app fail to compile.

Steps to Reproduce:
To emulate a merge:

1. Open a valid .storyboard file’s XML
2. In the inferredMetricsTieBreakers section, add an incorrect reference, for example:

        <segue reference=“abc-de-fgh”/>

3. Try to compile the app
4. Try running the storyboard through ibtool (`ibtool Main.storyboard`)

Expected Results:

I expect an error like: 

“Invalid segue reference “abc-de-fgh” in inferredMetricsTieBreakers section. If you deleted a segue during a source control merge, try deleting the segue reference.”

Actual Results:

Instead, I get this ibtool output with an NSArray exception:

2015-06-05 13:15:54.628 ibtoold[73000:8343663] Exception raised while unarchiving document objects - *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.ibtool.errors</key>
	<array>
		<dict>
			<key>description</key>
			<string>The document "Main.storyboard" could not be opened. The operation couldn’t be completed. (com.apple.InterfaceBuilder error -1.)</string>
			<key>recovery-suggestion</key>
			<string>Check the console log for additional information.</string>
		</dict>
	</array>
</dict>
</plist>

Regression:
Unknown

Notes:

It appears the parser assumes interpreting the segue reference will return a non-nil value. Instead, the parser should check for nil, and then return a helpful error message if the segue identified isn’t found.

Comments


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!