I have a project with a fairly complex storyboard (~13k lines). The project builds fine with Xcode 14, both locally and on Xcode Cloud. However, on Xcode 15 Release (And also the last Beta version) opening the storyboard causes Xcode to crash, while trying to compile the project fails with a crash in ibtool.
I've tried a few solutions to no avail.
I've tried to isolate the build issue and try running ibtool locally to see if I get more output. This is what I get:
/Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --output-format human-readable-text Main.storyboard
2023-09-20 18:54:17.690 ibtoold[289:56283117] [MT] DVTAssertions: ASSERTION FAILURE in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilderCocoaTouch/IDEInterfaceBuilderCocoaTouch-22130/InterfaceBuilder/WidgetIntegration/IBUIAutolayoutGuide/IBUIViewAutolayoutGuideIntegration.m:481
Details: code which should be unreachable has been reached
Object: <IBUIViewAutolayoutGuide: 0x6000068a6d00>
Method: -ibPrimitiveAddConstraintsToCandidateListOnly:thatAreAlreadyInDocument:
Thread: <_NSMainThread: 0x600001e241c0>{number = 1, name = main}
Hints:
Backtrace:
0 -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
1 _DVTAssertionHandler (in DVTFoundation)
2 _DVTAssertionFailureHandler (in DVTFoundation)
3 -[IBUIViewAutolayoutGuide(IBUIViewAutolayoutGuideIntegration) ibPrimitiveRemoveConstraintsFromCandidateListOnly:keepingInDocument:] (in IDEInterfaceBuilderCocoaTouchIntegration)
4 -[NSView(IBViewIntegration) ibMoveCandidateConstraint:toParent:alreadyInDocument:] (in IDEInterfaceBuilderKit)
5 -[NSView(IBViewIntegration) ibVerifyConstraintsAreWellFormedInDocument:subarbitrationUnitCache:andPopulateMessages:] (in IDEInterfaceBuilderKit)
6 -[IBDocumentVerifier _verifyConstraintsAndPopulateMessages:] (in IDEInterfaceBuilderKit)
7 -[IBDocumentVerifier verifyAndPopulateMessages:] (in IDEInterfaceBuilderKit)
8 -[IBCocoaTouchDocumentVerifier verifyAndPopulateMessages:] (in IDEInterfaceBuilderCocoaTouchIntegration)
9 -[IBiOSDocumentVerifier verifyAndPopulateMessages:] (in IDEInterfaceBuilderiOSIntegration)
10 -[IBiOSStoryboardDocumentVerifier verifyAndPopulateMessages:] (in IDEInterfaceBuilderiOSIntegration)
11 __41-[IBDocumentVerifier performVerification]_block_invoke (in IDEInterfaceBuilderKit)
12 -[IBDocumentAutolayoutManager ignoreAutolayoutStatusInvalidationDuring:] (in IDEInterfaceBuilderKit)
13 -[IBDocument ignoreAutolayoutStatusInvalidationDuring:] (in IDEInterfaceBuilderKit)
14 -[IBDocumentVerifier performVerification] (in IDEInterfaceBuilderKit)
15 -[IBDocument performVerification] (in IDEInterfaceBuilderKit)
16 -[IBDocument readFromURL:ofType:error:] (in IDEInterfaceBuilderKit)
17 IBLoadDocument (in ibtoold)
18 -[IBCLIInterfaceBuilderToolPersona invokeArguments:outputDictionary:] (in ibtoold)
19 -[IBCLIInterfaceBuilderToolPersona runSingleInvocation:outputtingToFileHandle:andVerifyingEnvironment:] (in ibtoold)
20 IBCLIServerRunSingleInvocation (in ibtoold)
21 __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke_2 (in ibtoold)
22 __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke (in ibtoold)
23 -[IBCLIErrorForwarder forwardErrorOutputToDescriptor:whileInvokingBlock:] (in ibtoold)
24 IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess (in ibtoold)
25 main (in ibtoold)
26 start (in dyld)
For anyone wondering, I was able to debug this further by using ibtool from Xcode 14.3 and fortunately a rather suspect warning caught my attention:
Main.storyboard:Aj5-Js-Cpe: warning: Unsupported configuration of constraint attributes. This may produce unexpected results at runtime before Xcode 5.1 [9]
Turns out, there is an invalid constraint in my project referencing safe area layout guide's xCenter as both first and second item:
<constraint firstItem="e5E-2f-Xpq" firstAttribute="centerX" secondItem="e5E-2f-Xpq" secondAttribute="centerX" id="Aj5-Js-Cpe"/>
Removing this constraint fixed the issue. Looks like this specific invalid constraint wasn't an issue for Xcode 14.3 but Xcode 15 is being more strict and crashing when it comes across this.