[__NSArrayM objectAtIndex:]

本文记录了一次因尝试访问空数组中不存在的元素而引发的NSRangeException异常情况。异常发生在UIScrollView及其相关组件的更新过程中,导致应用程序崩溃。通过对堆栈跟踪的分析,可以定位到问题的具体来源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2020-11-18 17:10:01.098273+0800 XXX应用名称[22083:2026022] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000011302a126 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x000000011c15df78 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001130a6cdb _CFThrowFormattedException + 194
	3   CoreFoundation                      0x0000000112f27e24 -[__NSArrayM objectAtIndex:] + 142
	4   UIKitCore                           0x000000012ec6135f -[_UIFlowLayoutInfo setSizes:forItemsAtIndexPaths:] + 617
	5   UIKitCore                           0x000000012ec42564 -[UICollectionViewFlowLayout _didPerformUpdateVisibleCellsPassWithLayoutOffset:] + 178
	6   UIKitCore                           0x000000012ebf41f3 -[UICollectionView _updateVisibleCellsNow:] + 11994
	7   UIKitCore                           0x000000012ebf425e -[UICollectionView _updateVisibleCellsNow:] + 12101
	8   UIKitCore                           0x000000012ebf425e -[UICollectionView _updateVisibleCellsNow:] + 12101
	9   UIKitCore                           0x000000012ebf7cf3 -[UICollectionView layoutSubviews] + 351
	10  UIKitCore                           0x000000012fa64686 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2874
	11  QuartzCore                          0x000000011a0a9e67 -[CALayer layoutSublayers] + 258
	12  QuartzCore                          0x000000011a0b0319 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 575
	13  UIKitCore                           0x000000012fa4fca1 -[UIView(Hierarchy) layoutBelowIfNeeded] + 573
	14  UIKitCore                           0x000000012ebffbbe -[UICollectionView setContentInset:] + 332
	15  XXX应用名称                      	0x000000010bb02c97 -[UIScrollView(MJExtension) setMj_insetT:] + 311
	16  XXX应用名称                      	0x000000010bafebf4 -[MJRefreshHeader scrollViewContentOffsetDidChange:] + 708
	17  XXX应用名称                      	0x000000010be8ab4e -[XXDIYNormalHeader scrollViewContentOffsetDidChange:] + 78
	18  XXX应用名称                      	0x000000010bafb9e6 -[MJRefreshComponent observeValueForKeyPath:ofObject:change:context:] + 326
	19  Foundation                          0x0000000116794124 NSKeyValueNotifyObserver + 329
	20  Foundation                          0x0000000116797858 NSKeyValueDidChange + 439
	21  Foundation                          0x00000001167971d8 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 741
	22  Foundation                          0x0000000116797a3b -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 68
	23  Foundation                          0x00000001167917db _NSSetPointValueAndNotify + 304
	24  UIKitCore                           0x000000012f9f3745 -[UIScrollView _adjustContentOffsetIfNecessary] + 53
	25  UIKitCore                           0x000000012f9cdba3 -[UIScrollView _updateForChangedScrollRelatedInsets] + 39
	26  UIKitCore                           0x000000012f9cd8de -[UIScrollView setContentInset:] + 178
	27  UIKitCore                           0x000000012ebffab8 -[UICollectionView setContentInset:] + 70
	28  XXX应用名称                      	0x000000010bb02c97 -[UIScrollView(MJExtension) setMj_insetT:] + 311
	29  XXX应用名称                      	0x000000010baff746 __28-[MJRefreshHeader setState:]_block_invoke_2 + 214
	30  UIKitCore                           0x000000012fa5895a +[UIView _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 573
	31  UIKitCore                           0x000000012fa58e98 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:completion:] + 74
	32  XXX应用名称                      	0x000000010baff63f __28-[MJRefreshHeader setState:]_block_invoke.71 + 271
	33  libdispatch.dylib                   0x000000011d7198ac _dispatch_call_block_and_release + 12
	34  libdispatch.dylib                   0x000000011d71aa88 _dispatch_client_callout + 8
	35  libdispatch.dylib                   0x000000011d728f23 _dispatch_main_queue_callback_4CF + 1152
	36  CoreFoundation                      0x0000000112f98276 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	37  CoreFoundation                      0x0000000112f92b06 __CFRunLoopRun + 2685
	38  CoreFoundation                      0x0000000112f91b9e CFRunLoopRunSpecific + 567
	39  GraphicsServices                    0x000000011e646db3 GSEventRunModal + 139
	40  UIKitCore                           0x000000012f50440f -[UIApplication _run] + 912
	41  UIKitCore                           0x000000012f509320 UIApplicationMain + 101
	42  XXX应用名称                      	0x000000010afb2693 main + 131
	43  libdyld.dylib                       0x000000011d7a9409 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
terminating with uncaught exception of type NSException
CoreSimulator 732.17 - Device: iPhone 11 (762FD828-9E8C-4E5F-B380-2F30C09F3490) - Runtime: iOS 14.1 (18A8394) - DeviceType: iPhone 11

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值