Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Crash in iOS 8 when remove a view from UIStackView

Aperta
#35 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
ios, objective-c
Ambito
mobile-dev

Direzione di ricerca

Riproduci il problema segnalato in un simulatore iOS 8 utilizzando uno storyboard UIStackView con tre pulsanti, quindi traccia lo stack da FDStackView.updateConstraints passando per FDStackViewLayoutArrangement fino a FDStackViewDistributionLayoutArrangement. Ispeziona resetFillEffect, resetAllConstraints e updateCanvasConnectionConstraintsIfNecessary; il lavoro è completato quando la rimozione di un pulsante non causa più un crash durante il layout su iOS 8, mentre il comportamento su iOS 9 rimane invariato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

状况如下:

  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

Lingua principale
Objective-C
Stelle
2.5k
Fork
310
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di forkingdog/FDStackView

Tutte le issue di forkingdog/FDStackView

Issue simili

Altre issue su Objective-C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.