I have a problem with my 'Main.storyboard' file. I am using Xcode 13.3.1. Here is an image of the Interface Builder:
As you can see, one of the view controllers is only showing the bounds of its subviews.
Here is the 'Log.txt' file that I got when I clicked on 'Report a Bug':
ASSERTION:
=================================
Failed to update scene 'WYl-z5-IOU' with IBLayoutConstraint (x181), IBUIViewAutolayoutGuide (x1), UIButton (x12), UICollectionView (x3), UICollectionViewCell (x3), UICollectionViewFlowLayout (x3), UIImageView (x8), UILabel (x20), UIPageControl (x1), UIScrollView (x1), UIStackView (x10), UITextField (x1), UIView (x18), and UIViewController (x1).
Exception name: NSRangeException
Exception reason: *** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array
Exception backtrace:
0. CoreFoundation 0x00007fff20406d34 __exceptionPreprocess
1. libobjc.A.dylib 0x00007fff201a4a65 objc_exception_throw
2. CoreFoundation 0x00007fff20487f47 _CFThrowFormattedException
3. CoreFoundation 0x00007fff203016b2 -[__NSArrayM objectAtIndexedSubscript:]
4. UIKitCore 0x00007fff247448bc -[_UIFlowLayoutSection computeLayoutInRect:forSection:invalidating:invalidationContext:]
5. UIKitCore 0x00007fff24728a75 __76-[UICollectionViewFlowLayout _updateItemsLayoutForRect:allowsPartialUpdate:]_block_invoke
6. CoreFoundation 0x00007fff2037682c __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
7. CoreFoundation 0x00007fff203009c6 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]
8. UIKitCore 0x00007fff2472871d -[UICollectionViewFlowLayout _updateItemsLayoutForRect:allowsPartialUpdate:]
9. UIKitCore 0x00007fff24728cee -[UICollectionViewFlowLayout _fetchItemsInfoForRect:]
10. UIKitCore 0x00007fff24721950 -[UICollectionViewFlowLayout prepareLayout]
11. UIKitCore 0x00007fff2471b450 -[UICollectionViewData _prepareToLoadData]
12. UIKitCore 0x00007fff2471c2b5 -[UICollectionViewData validateLayoutInRect:]
13. UIKitCore 0x00007fff246db9f1 -[UICollectionView layoutSubviews]
14. UIKitCore 0x00007fff2565a2b0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
15. QuartzCore 0x00007fff28a6639d _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE
16. UIKitCore 0x00007fff256457fa -[UIView(Hierarchy) layoutBelowIfNeeded]
17. IBCocoaTouchToolFoundation 0x000000010832fa2d -[IBCocoaTouchToolAutolayoutEngine layoutIfNeeded]
18. IBAutolayoutFoundation 0x000000010847f736 __54-[IBAutolayoutEngine initWithArbitrationUnit:options:]_block_invoke.46
19. CoreAutoLayout 0x00007fff60b03f05 -[NSISEngine performModifications:withUnsatisfiableConstraintsHandler:]
20. IBAutolayoutFoundation 0x000000010848df03 -[NSObject(IBAutolayoutFrameworkSupportInternal) ib_performModifications:withUnsatisfiableConstraintsHandler:]
21. IBAutolayoutFoundation 0x000000010847fbc8 -[IBAutolayoutEngine performInternalEngineModificationsAndAssertOnUnsatisfiableConstraintsIfNeededDuring:withUnsatisfiableConstraintsHandler:]
22. IBAutolayoutFoundation 0x0000000108483915 -[IBAutolayoutEngine continuouslyPerformEngineBootstrappingOperationWithName:untilSuccessWhileTrackingUnsatisfiableConstraintsDuring:withUnsatisfiableConstraintRemovedHandler:]
23. IBAutolayoutFoundation 0x000000010847f58b -[IBAutolayoutEngine initWithArbitrationUnit:options:]
24. IBAutolayoutFoundation 0x000000010846eb72 -[IBAutolayoutArbitrationUnit computeStatus]
25. IBCocoaTouchToolFoundation 0x000000010834cdb0 -[IBAutolayoutStatusProcessingRequest(IBCTTSupport) produceResultForRequest:simulatedMetricsContext:scaleFactor:tool:]
26. IBCocoaTouchToolFoundation 0x000000010836f7e8 IBCTTRunProcessingRequestsPopulatingResults
27. IBCocoaTouchToolFoundation 0x000000010836fbd0 __IBCTTProduceResultForSceneUpdateRequest_block_invoke_2
28. IBCocoaTouchToolFoundation 0x00000001083760e0 -[IBCTTUISimulatedMetricsContext applyGlobalAndAdditionalSimulatedMetricsForTool:during:]
29. IBCocoaTouchToolFoundation 0x000000010836f3fe IBCTTProduceResultForSceneUpdateRequest
30. IBCocoaTouchToolFoundation 0x000000010833b326 -[IBCocoaTouchTool updateScenesWithSceneUpdateRequests:]
31. AssetCatalogFoundation 0x00000001086877e1 __80-[IBMessageReceiveChannel deliverMessage:toTarget:withArguments:context:result:]_block_invoke
32. AssetCatalogFoundation 0x000000010868767e -[IBMessageReceiveChannel deliverMessage:toTarget:withArguments:context:result:]
33. AssetCatalogFoundation 0x000000010868710e __88-[IBMessageReceiveChannel runBlockingReceiveLoopNotifyingQueue:notifyingTarget:context:]_block_invoke
34. libdispatch.dylib 0x00007fff20115b25 _dispatch_client_callout
35. libdispatch.dylib 0x00007fff20123de6 _dispatch_async_and_wait_invoke
36. libdispatch.dylib 0x00007fff20115b25 _dispatch_client_callout
37. libdispatch.dylib 0x00007fff20123043 _dispatch_main_queue_drain
38. libdispatch.dylib 0x00007fff20122c1b _dispatch_main_queue_callback_4CF
39. CoreFoundation 0x00007fff20373261 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
40. CoreFoundation 0x00007fff2036da56 __CFRunLoopRun
41. CoreFoundation 0x00007fff2036ca90 CFRunLoopRunSpecific
42. Foundation 0x00007fff20827e31 -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
43. AssetCatalogFoundation 0x000000010865a5de -[IBAbstractPlatformTool startServingReceiveChannel:]
44. AssetCatalogFoundation 0x000000010865a829 -[IBAbstractPlatformTool startServingWriteDescriptor:readDescriptor:]
45. AssetCatalogFoundation 0x000000010865b544 +[IBAbstractPlatformTool main]
46. IBAgent-iOS 0x0000000107e16983 main
47. ??? 0x0000000108030f21 ???
48. ??? 0x0000000111a9a51e [DVTFoundation.UIKitForMacInfo init]
Exception info:{
}
=================================
EXCEPTION:
=================================
*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array
I may be wrong but the error seems to be related to my collection views. I dropped a view into a collection view rather than a stack view and then this error came. Can someone help me understand the error and how to fix it? Thank you in advance!
Well, I tried creating a new collection view and it worked! I know that's tedious so please continue answering. Thank you.