【问题标题】:UITableView tableHeaderView crash using beginUpdates/endUpdates settingsUITableView tableHeaderView 使用 beginUpdates/endUpdates 设置崩溃
【发布时间】:2018-02-06 03:07:05
【问题描述】:

我在使用beginUpdates&endUpdates设置UITableView tableHeaderView的时候,每天都会在259行出现几十个crash 代码:

[self.tableView beginUpdates];
self.tableView.tableHeaderView=self.topView;
[self.tableView endUpdates];     // line 259  crash 

下面是崩溃信息:

 13 UIKit                          0x18fe43090 UIViewAlertForUnsatisfiableConstraints + 66
 14 Foundation                     0x18a0b94cc -[NSISEngine handleUnsatisfiableRowWithHead:body:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 464
 15 Foundation                     0x18a099df8 -[NSISEngine tryUsingArtificialVariableToAddConstraintWithMarker:rowBody:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 384
 16 Foundation                     0x18a0959c4 -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 688
 17 Foundation                     0x18a0955cc -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 284
 18 Foundation                     0x18a0931e0 -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 272
 19 UIKit                          0x18f5ee400 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 396
 20 Foundation                     0x18a092d10 -[NSISEngine withBehaviors:performModifications:] + 168
 21 UIKit                          0x18f5ee20c __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 564
 22 UIKit                          0x18f4eab14 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 224
 23 UIKit                          0x18f5ee338 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 196
 24 Foundation                     0x18a092d10 -[NSISEngine withBehaviors:performModifications:] + 168
 25 UIKit                          0x18f5ee20c __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 564
 26 UIKit                          0x18f4eab14 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 224
 27 UIKit                          0x18f62bcf0 -[UIView(AdditionalLayoutSupport) _initializeHostedLayoutEngine] + 460
 28 UIKit                          0x18f5eb334 -[UIView(AdditionalLayoutSupport) _layoutEngineCreateIfNecessary] + 64
 29 UIKit                          0x18f5eafc8 -[UIView(UIConstraintBasedLayout) _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 132
 30 UIKit                          0x18f5eed28 -[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] + 872
 31 UIKit                          0x18fe3f1f8 -[UIView(AdditionalLayoutSupport) _updateSystemConstraints] + 116
 32 UIKit                          0x18f5f05a8 -[UIButton updateConstraints] + 3412
 33 UIKit                          0x18fe3de80 -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] + 192
 34 UIKit                          0x18fe3e1d0 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 632
 35 UIKit                          0x18fe3e158 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 512
 36 UIKit                          0x18fe3e158 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 512
 37 UIKit                          0x18fe3e974 __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 84
 38 UIKit                          0x18fe3db30 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 136
 39 UIKit                          0x18fe3e580 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 164
 40 UIKit                          0x18fe3f58c -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 372
 41 UIKit                          0x18f500328 -[UIView(Hierarchy) layoutBelowIfNeeded] + 544
 42 UIKit                          0x18f4fc7dc +[UIView(Animation) performWithoutAnimation:] + 104
 43 UIKit                          0x18f821b2c __46-[UITableView _updateWithItems:updateSupport:]_block_invoke.996 + 1984
 44 UIKit                          0x18f5240f0 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 636

【问题讨论】:

  • 45 UIKit 0x18f53ab6c +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 108 46 UIKit 0x18f6ed0d4 -[UITableView _updateWithItems:updateSupport:] + 3560 47 UIKit 0x18f6d1588-[UITableViewWithContext :] + 14408 48 ZZKKO 0x100153430 -[GoodsDetailVC initView] (GoodsDetailVC.m:259)
  • 49 ZZKKO 0x100152550 -[GoodsDetailVC viewDidLoad] (GoodsDetailVC.m:128) 50 UIKit 0x18f4ee924 -[UIViewController loadViewIfRequired] + 1056 51 UIKit 0x18f4ee4ec -[UIKit 0x18f4ee4ec -[UIKit 0x18f4ee4ec] + 28per pusheTo6GoodViewController view] + 28200pusheTo6GoodViewWithDetailWith[VCaeTransitionH1] :imageView:navigationVC:]
  • 你能用上面的细节更新你的帖子吗?所以它更易于人类阅读,拜托。

标签: ios iphone uitableview


【解决方案1】:

只需删除[self.tableView beginUpdates];[self.tableView endUpdates];

【讨论】:

    【解决方案2】:

    你如何设置 self.topView 的约束?查看堆栈跟踪,似乎系统无法满足所有约束。我会查看topView 并确保所有约束都有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-01
      • 1970-01-01
      • 2016-03-19
      • 1970-01-01
      • 2013-08-18
      • 1970-01-01
      • 1970-01-01
      • 2012-05-19
      相关资源
      最近更新 更多