apple/iOS, UIKit, Documentation

[Crash] Content View returned an invaild size

lgvv 2025. 5. 19. 22:05

[Crash] Content View returned an invaild size

 

 

크래시 분석

- Compositional Layout을 사용할 때 item, group의 width 혹은 height을 모두 estimated로 둔 상태에서 Cell 내부의 레이아웃을 제대로 잡아주지 않은 경우에 발생.

- 혹은 ContentConfiguration을 사용할 때 레이아웃 구성상 intrinsiccontentsize을 통해 View의 크기를 결정할 수도 있는데, 값을 넣어주지 않을 때도 발생.

 

 

 

 

크래시 전체 로그


*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Content view returned an invalid size {1.7976931348623157e+308, 1.7976931348623157e+308} from -systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority: which is not allowed. If you have implemented a custom content view, you need to add constraints inside it so that its size is not ambiguous, or you need to manually compute and return a valid size. Content view: <ArchitetureExample.CustomContentView: 0x102606570; frame = (0 0; 44 44); gestureRecognizers = <NSArray: 0x600000014690>; layer = <CALayer: 0x6000002454e0>>'

*** First throw call stack:

(

0   CoreFoundation                      0x00000001804b70ec __exceptionPreprocess + 172

1   libobjc.A.dylib                     0x000000018008ede8 objc_exception_throw + 72

2   Foundation                          0x0000000180e73c40 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0

3   UIKitCore                           0x00000001851e5d30 -[UICollectionViewCell systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 1312

4   UIKitCore                           0x00000001851e05b8 -[UICollectionReusableView preferredLayoutAttributesFittingAttributes:] + 240

5   UIKitCore                           0x00000001851e01ac -[UICollectionReusableView _preferredLayoutAttributesFittingAttributes:isAnimatingExistingView:] + 152

6   UIKitCore                           0x00000001851a49c8 -[UICollectionView _checkForPreferredAttributesInView:originalAttributes:] + 240

7   UIKitCore                           0x00000001851a5ff4 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 1948

8   UIKitCore                           0x00000001851af2bc -[UICollectionView _createVisibleViewsForSingleCategoryAttributes:limitCreation:fadeForBoundsChange:] + 520

9   UIKitCore                           0x00000001851af824 -[UICollectionView _createVisibleViewsForAttributes:fadeForBoundsChange:notifyLayoutForVisibleCellsPass:] + 288

10  UIKitCore                           0x00000001851ad9c4 -[UICollectionView _updateVisibleCellsNow:] + 3196

11  UIKitCore                           0x00000001851b2af0 -[UICollectionView layoutSubviews] + 284

12  UIKitCore                           0x000000018601c0c4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2404

13  QuartzCore                          0x000000018b06ceb0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 432

14  QuartzCore                          0x000000018b077c34 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 124

15  QuartzCore                          0x000000018afacc58 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 464

16  QuartzCore                          0x000000018afdb468 _ZN2CA11Transaction6commitEv + 652

17  UIKitCore                           0x0000000185abb7b4 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 32

18  CoreFoundation                      0x000000018041b0ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20

19  CoreFoundation                      0x000000018041a824 __CFRunLoopDoBlocks + 352

20  CoreFoundation                      0x00000001804150c8 __CFRunLoopRun + 812

21  CoreFoundation                      0x0000000180414960 CFRunLoopRunSpecific + 536

22  GraphicsServices                    0x0000000190183b10 GSEventRunModal + 160

23  UIKitCore                           0x0000000185aa2b40 -[UIApplication _run] + 796

24  UIKitCore                           0x0000000185aa6d38 UIApplicationMain + 124

25  UIKitCore                           0x0000000184e9a184 block_destroy_helper.22 + 9660

26  ArchitetureExample.debug.dylib      0x0000000101dcb7c4 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 120

27  ArchitetureExample.debug.dylib      0x0000000101dcb73c $s18ArchitetureExample11AppDelegateC5$mainyyFZ + 44

28  ArchitetureExample.debug.dylib      0x0000000101dcb840 __debug_main_executable_dylib_entry_point + 28

29  dyld                                0x0000000100f9d410 start_sim + 20

30  ???                                 0x0000000101136b98 0x0 + 4313017240

)

libc++abi: terminating due to uncaught exception of type NSException