collectionViewCell内只放了一个Label致使崩溃,全局断点无法拦截,只能看到控制台崩溃
image.png*** Assertion failure in -[_UIUpdateVisibleCellsContext addPreferredAttributes:], UICollectionViewLayout.m:2914
dynamic_cast error 2: One or more of the following type_info's has hidden visibility or is defined in more than one translation unit. They should all have public visibility. N10__cxxabiv116__shim_type_infoE, id, N10__cxxabiv117__pbase_type_infoE.
dynamic_cast error 2: One or more of the following type_info's has hidden visibility or is defined in more than one translation unit. They should all have public visibility. N10__cxxabiv116__shim_type_infoE, id, N10__cxxabiv117__pbase_type_infoE.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !CGSizeEqualToSize(size, CGSizeZero)'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff8004288ab __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff80004dba3 objc_exception_throw + 48
2 Foundation 0x00007ff800b870cc _userInfoForFileAndLine + 0
3 UIKitCore 0x000000010b9c9501 -[_UIUpdateVisibleCellsContext addPreferredAttributes:] + 527
4 UIKitCore 0x000000010b9b7908 -[UICollectionViewFlowLayout shouldInvalidateLayoutForPreferredLayoutAttributes:withOriginalAttributes:] + 351
5 UIKitCore 0x000000010b95566b -[UICollectionView _checkForPreferredAttributesInView:originalAttributes:] + 489
6 UIKitCore 0x000000010b956de6 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 1711
7 UIKitCore 0x000000010b956731 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 31
8 UIKitCore 0x000000010b960d47 -[UICollectionView _createVisibleViewsForSingleCategoryAttributes:limitCreation:fadeForBoundsChange:] + 1731
9 UIKitCore 0x000000010b96124b -[UICollectionView _createVisibleViewsForAttributes:fadeForBoundsChange:notifyLayoutForVisibleCellsPass:] + 376
10 UIKitCore 0x000000010b95efad -[UICollectionView _updateVisibleCellsNow:] + 2331
11 UIKitCore 0x000000010b965bc4 -[UICollectionView layoutSubviews] + 375
12 UIKitCore 0x000000010ca8f59f -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2305
13 QuartzCore 0x00007ff80898b02c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 526
14 QuartzCore 0x00007ff8089965b9 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 65
15 QuartzCore 0x00007ff8088a7b0c _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 626
16 QuartzCore 0x00007ff8088df69b _ZN2CA11Transaction6commitEv + 735
17 QuartzCore 0x00007ff8088e0b64 _ZN2CA11Transaction25flush_as_runloop_observerEb + 60
18 CoreFoundation 0x00007ff800387055 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
19 CoreFoundation 0x00007ff8003819c2 __CFRunLoopDoObservers + 515
20 CoreFoundation 0x00007ff800381f0d __CFRunLoopRun + 1161
21 CoreFoundation 0x00007ff8003816a7 CFRunLoopRunSpecific + 560
22 GraphicsServices 0x00007ff809cb128a GSEventRunModal + 139
23 UIKitCore 0x000000010c45cad3 -[UIApplication _run] + 994
24 UIKitCore 0x000000010c4619ef UIApplicationMain + 123
25 CaiFuBang 0x0000000109575c18 main + 104
26 dyld 0x000000010ab102bf start_sim + 10
27 ??? 0x000000010ef57310 0x0 + 4545934096
)
2023-08-16 09:55:32.619077+0800 CaiFuBang[73323:19785329] [Bugly] Trapped uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !CGSizeEqualToSize(size, CGSizeZero)'
(
0 CoreFoundation 0x00007ff8004288ab __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff80004dba3 objc_exception_throw + 48
2 Foundation 0x00007ff800b870cc _userInfoForFileAndLine + 0
3 UIKitCore 0x000000010b9c9501 -[_UIUpdateVisibleCellsContext addPreferredAttributes:] + 527
4 UIKitCore 0x000000010b9b7908 -[UICollectionViewFlowLayout shouldInvalidateLayoutForPreferredLayoutAttributes:withOriginalAttributes:] + 351
5 UIKitCore 0x000000010b95566b -[UICollectionView _checkForPreferredAttributesInView:originalAttributes:] + 489
6 UIKitCore 0x000000010b956de6 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 1711
7 UIKitCore 0x000000010b956731 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 31
8 UIKitCore 0x000000010b960d47 -[UICollectionView _createVisibleViewsForSingleCategoryAttributes:limitCreation:fadeForBoundsChange:] + 1731
9 UIKitCore 0x000000010b96124b -[UICollectionView _createVisibleViewsForAttributes:fadeForBoundsChange:notifyLayoutForVisibleCellsPass:] + 376
10 UIKitCore 0x000000010b95efad -[UICollectionView _updateVisibleCellsNow:] + 2331
11 UIKitCore 0x000000010b965bc4 -[UICollectionView layoutSubviews] + 375
12 UIKitCore 0x000000010ca8f59f -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2305
13 QuartzCore 0x00007ff80898b02c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 526
14 QuartzCore 0x00007ff8089965b9 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 65
15 QuartzCore 0x00007ff8088a7b0c _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 626
16 QuartzCore 0x00007ff8088df69b _ZN2CA11Transaction6commitEv + 735
17 QuartzCore 0x00007ff8088e0b64 _ZN2CA11Transaction25flush_as_runloop_observerEb + 60
18 CoreFoundation 0x00007ff800387055 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
19 CoreFoundation 0x00007ff8003819c2 __CFRunLoopDoObservers + 515
20 CoreFoundation 0x00007ff800381f0d __CFRunLoopRun + 1161
21 CoreFoundation 0x00007ff8003816a7 CFRunLoopRunSpecific + 560
22 GraphicsServices 0x00007ff809cb128a GSEventRunModal + 139
23 UIKitCore 0x000000010c45cad3 -[UIApplication _run] + 994
24 UIKitCore 0x000000010c4619ef UIApplicationMain + 123
25 CaiFuBang 0x0000000109575c18 main + 104
26 dyld 0x000000010ab102bf start_sim + 10
27 ??? 0x000000010ef57310 0x0 + 4545934096
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !CGSizeEqualToSize(size, CGSizeZero)'
terminating with uncaught exception of type NSException
CoreSimulator 857.14 - Device: iPhone 14 Pro (FC0C4325-685D-4CB2-8B18-A23F8EA22CC6) - Runtime: iOS 16.2 (20C52) - DeviceType: iPhone 14 Pro
产生原因:
image.pngstoryboard拖的collectionView 默认预估大小自动计算,解决办法设置none
网友评论