Ios 如何防止在具有大量数据的tableview中使用autolayout时崩溃?
在具有大量数据的tableview中快速滚动时得到此崩溃报告 nsGenericeException集合在枚举时发生了变异。 tableview在单元格中使用autolayout,通过分析堆栈跟踪,我猜它有问题。有解决办法吗 这些约束是通过interface builder添加的,布局没有问题。界面中没有警告或错误。也许解决方案只是在tableview中使用更少的数据,但我想知道是否有更好的解决方案Ios 如何防止在具有大量数据的tableview中使用autolayout时崩溃?,ios,objective-c,uitableview,autolayout,Ios,Objective C,Uitableview,Autolayout,在具有大量数据的tableview中快速滚动时得到此崩溃报告 nsGenericeException集合在枚举时发生了变异。 tableview在单元格中使用autolayout,通过分析堆栈跟踪,我猜它有问题。有解决办法吗 这些约束是通过interface builder添加的,布局没有问题。界面中没有警告或错误。也许解决方案只是在tableview中使用更少的数据,但我想知道是否有更好的解决方案 CoreFoundation 0x30c46f4b __exceptionPreprocess
CoreFoundation 0x30c46f4b __exceptionPreprocess + 131
libobjc.A.dylib 0x3b0876af objc_exception_throw + 39
CoreFoundation 0x30c46a49 -[NSException name] + 1
Foundation 0x315abb83 -[NSISEngine substituteOutAllOccurencesOfBodyVar:withExpression:] + 439
Foundation 0x315ae80f -[NSISEngine pivotToMakeBodyVar:newHeadOfRowWithHead:andDropRow:] + 339
Foundation 0x315ac595 -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 237
Foundation 0x315ac0c7 -[NSISEngine optimize] + 175
Foundation 0x315b1ccb -[NSISEngine constraintDidChangeSuchThatMarker:shouldBeReplacedByMarkerPlusDelta:] + 307
Foundation 0x315b1b43 -[NSISEngine tryToChangeConstraintSuchThatMarker:isReplacedByMarkerPlusDelta:undoHandler:] + 423
Foundation 0x315a73f7 -[NSLayoutConstraint _tryToChangeContainerGeometryWithUndoHandler:] + 467
Foundation 0x315a6f95 -[NSLayoutConstraint _setSymbolicConstant:constant:] + 381
UIKit 0x334b2e6b -[UIView(UIConstraintBasedLayout) _autoresizingConstraints_frameDidChange] + 367
UIKit 0x333b6f1f -[UIView(Geometry) setFrame:] + 671
UIKit 0x333d871b -[UIScrollView setFrame:] + 131
UIKit 0x33489a97 -[UITableViewCell setFrame:] + 527
UIKit 0x334ece65 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 617
UIKit 0x333cb6e5 +[UIView(Animation) performWithoutAnimation:] + 73
UIKit 0x334ecbf9 -[UITableView _configureCellForDisplay:forIndexPath:] + 101
UIKit 0x334eba73 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 435
UIKit 0x33493de7 -[UITableView _updateVisibleCellsNow:] + 1655
UIKit 0x33493699 -[UITableView layoutSubviews] + 185
UIKit 0x333b9da3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 347
QuartzCore 0x33040c6b -[CALayer layoutSublayers] + 143
QuartzCore 0x3303c47b _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 351
QuartzCore 0x3303c30d _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 17
QuartzCore 0x3303bd1f _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 231
QuartzCore 0x3303bb2f _ZN2CA11Transaction6commitEv + 315
QuartzCore 0x33090825 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 517
IOMobileFramebuffer 0x35cbd76d IOMobileFramebufferVsyncNotifyFunc + 105
IOKit 0x31928a75 IODispatchCalloutFromCFMessage + 249
CoreFoundation 0x30c06e21 __CFMachPortPerform + 137
CoreFoundation 0x30c119df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35
CoreFoundation 0x30c1197b __CFRunLoopDoSource1 + 347
CoreFoundation 0x30c1014f __CFRunLoopRun + 1399
CoreFoundation 0x30b7ac27 CFRunLoopRunSpecific + 523
CoreFoundation 0x30b7aa0b CFRunLoopRunInMode + 107
GraphicsServices 0x358a1283 GSEventRunModal + 139
UIKit 0x3341e049 UIApplicationMain + 1137
LiveCom 0x000a82c5 main (main.m:16)
libdyld.dylib 0x3b58fab7 start + 3
如何向表/单元格提供数据?数据本身不应成为问题,因为崩溃发生在所有数据都已加载时。在崩溃发生的场景中,表中没有插入或删除单元格这样的更新。这与细胞的再利用有关。特别是关于更新单元格的框架。问题是,当您使用autolayout时,您不能直接更改单元格的框架,您必须通过更改约束来完成。我就是这样做的。在cellForRowAtIndexPath中:我检查数据(在本例中,单元格对应于时间线中的帖子,应用程序是facebook之类的社交网络),如果有图像,我会相应地更改约束条件,使单元格更高以适合图像@我开始认为这是苹果的错误,我无能为力。我也有同样的问题,你有更多的信息吗?