Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Crash in iOS 8 when remove a view from UIStackView

オープン
#35 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
ios, objective-c
領域
mobile-dev

調査の方向性

3つのボタンを持つ storyboard UIStackView を使用して iOS 8 シミュレータで報告内容を再現し、次に FDStackView.updateConstraints から FDStackViewLayoutArrangement、FDStackViewDistributionLayoutArrangement までスタックを追跡します。resetFillEffect、resetAllConstraints、updateCanvasConnectionConstraintsIfNecessary を調査します。完了条件は、iOS 8 でレイアウト中にボタンを削除してもクラッシュしなくなり、iOS 9 の動作には影響がないことです。

索引モデルが issue の本文から書いたものです。

説明

状况如下:

  1. iOS 8 模拟器
  2. StoryBoard 布局好了,一个StackView上有3个等长Button
  3. 在ViewController viewDidLoad/viewDidAppear 时,将一个按钮 removeFromSuperView
    崩溃~
    iOS 9下没问题~

以下Log

2016-06-21 15:40:41.868 Mingdao[73952:20315626] The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x7f00c1d0 UIButton:0x79ecc510.leading == UIButton:0x7abcd710.trailing>
When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView _viewHierarchyUnpreparedForConstraint:] to debug.
2016-06-21 15:40:41.868 Mingdao[73952:20315626] *** Assertion failure in -[UIStackView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:], /SourceCache/UIKit_Sim/UIKit-3347.44.2/NSLayoutConstraint_UIKitAdditions.m:560
2016-06-21 15:40:41.881 Mingdao[73952:20315626] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Impossible to set up layout with view hierarchy unprepared for constraint.'
*** First throw call stack:
(
0 CoreFoundation 0x01498746 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x04524a97 objc_exception_throw + 44
2 CoreFoundation 0x014985da +[NSException raise:format:arguments:] + 138
3 Foundation 0x01f75720 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118
4 UIKit 0x032f22c1 __120-[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:]_block_invoke_2 + 203
5 UIKit 0x032f2184 -[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 394
6 UIKit 0x032f2507 -[UIView(UIConstraintBasedLayout) _tryToAddConstraintWithoutUpdatingConstraintsArray:roundingAdjustment:mutuallyExclusiveConstraints:] + 61
7 UIKit 0x032f265c -[UIView(UIConstraintBasedLayout) _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 281
8 UIKit 0x032f2854 -[UIView(UIConstraintBasedLayout) nsli_addConstraint:] + 56
9 UIKit 0x032f2814 -[UIView(UIConstraintBasedLayout) _addConstraint:] + 218
10 UIKit 0x032f2735 -[UIView(UIConstraintBasedLayout) addConstraint:] + 40
11 Mingdao 0x005555a0 -[FDStackViewDistributionLayoutArrangement resetFillEffect] + 1632
12 Mingdao 0x00557589 -[FDStackViewDistributionLayoutArrangement resetAllConstraints] + 73
13 Mingdao 0x00557b3d -[FDStackViewDistributionLayoutArrangement updateCanvasConnectionConstraintsIfNecessary] + 45
14 Mingdao 0x0055893d -[FDStackViewLayoutArrangement updateArrangementConstraints] + 45
15 Mingdao 0x0055076d -[FDStackView updateLayoutArrangements] + 221
16 Mingdao 0x00550800 -[FDStackView updateConstraints] + 48
17 UIKit 0x032ff5a4 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 300
18 UIKit 0x032ff804 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 127
19 UIKit 0x032ff77f __UIViewRecursionHelper + 41
20 CoreFoundation 0x0138b529 CFArrayApplyFunction + 57
21 UIKit 0x032ff527 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 175
22 UIKit 0x032ff804 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 127
23 UIKit 0x032ff77f __UIViewRecursionHelper + 41
24 CoreFoundation 0x0138b529 CFArrayApplyFunction + 57
25 UIKit 0x032ff527 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 175
26 UIKit 0x032ff837 __125-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:]_block_invoke + 43
27 Foundation 0x01ef1077 -[NSISEngine withBehaviors:performModifications:] + 150
28 Foundation 0x01ef45cf -[NSISEngine withAutomaticOptimizationDisabled:] + 48
29 UIKit 0x032fefab -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 64
30 UIKit 0x032ff804 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:] + 127
31 UIKit 0x032ffd96 __60-[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded]_block_invoke + 105
32 Foundation 0x01ef1077 -[NSISEngine withBehaviors:performModifications:] + 150
33 Foundation 0x01ef45cf -[NSISEngine withAutomaticOptimizationDisabled:] + 48
34 UIKit 0x032fefab -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 64
35 UIKit 0x032ff9ec -[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded] + 248
36 UIKit 0x0330024d -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeeded] + 191
37 UIKit 0x02c0adaf -[UIView(Hierarchy) layoutBelowIfNeeded] + 393
38 UIKit 0x02c0ac11 -[UIView(Hierarchy) layoutIfNeeded] + 83
39 UIKit 0x02d22bc5 -[UINavigationController _layoutViewController:] + 1154
40 UIKit 0x02d21d41 -[UINavigationController _layoutTopViewController] + 261
41 UIKit 0x02d26fd9 -[UINavigationController _tabBarControllerDidFinishShowingTabBar:isHidden:] + 164
42 UIKit 0x02d377d0 -[UITabBarController animationDidStop:finished:context:] + 218
43 UIKit 0x02d38771 __56-[UITabBarController _hideBarWithTransition:isExplicit:]_block_invoke503 + 267
44 UIKit 0x033f3f0b -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 198
45 UIKit 0x033f05c0 -[_UIViewControllerTransitionContext _runAlongsideCompletions] + 122
46 UIKit 0x033f02dc -[_UIViewControllerTransitionContext completeTransition:] + 142
47 UIKit 0x02b73310 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke93 + 724
48 UIKit 0x02c1096e -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 318
49 UIKit 0x02bf4162 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 206
50 UIKit 0x02bf44d2 -[UIViewAnimationState animationDidStop:finished:] + 80
51 QuartzCore 0x02907571 _ZN2CA5Layer23run_animation_callbacksEPv + 307
52 libdispatch.dylib 0x0574ebef _dispatch_client_callout + 14
53 libdispatch.dylib 0x057346bb _dispatch_main_queue_callback_4CF + 993
54 CoreFoundation 0x013f18ee CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 14
55 CoreFoundation 0x013af5f0 __CFRunLoopRun + 2256
56 CoreFoundation 0x013aea5b CFRunLoopRunSpecific + 443
57 CoreFoundation 0x013ae88b CFRunLoopRunInMode + 123
58 GraphicsServices 0x076342c9 GSEventRunModal + 192
59 GraphicsServices 0x07634106 GSEventRun + 104
60 UIKit 0x02b860b6 UIApplicationMain + 1526
61 Mingdao 0x002c86aa main + 138
62 libdyld.dylib 0x05779ac9 start + 1
63 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

主要言語
Objective-C
スター
2.5k
フォーク
310
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

forkingdog/FDStackView のほかの issue

forkingdog/FDStackView の issue をすべて見る

似ている issue

Objective-C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。