无法找到传入头部UIButton的传出行头

我在iOS7上的自动布局问题上崩溃了(iOS8可以工作)

问题是 – UIButton指示(0x7b7780a0)不存在(当我查看UIView recursiveDescription时)。

我该如何调查? 从哪儿开始?

编辑:

我遇到了这个答案, https://stackoverflow.com/a/27284071/429249 ,实际上我在回溯中有一个非常小的浮点数,但是 – 我没有在代码中添加约束,我的所有乘数都是1

编辑:给自己发了一个答案 – 但https://stackoverflow.com/a/27284071/429249是一个很好的答案,最终指导我解决方案

碰撞:

  2015-03-10 15:50:08.152 Cookila copy[5779:607] Objective: {objective 0x7b84c960:  + *UIButton:0x7b6299c0.Width{id: 408} + *UIButton:0x7b661ad0.Width{id: 385} + *UIButton:0x7b7780a0.Width{id: 388} + *UIView:0x7b6547d0.Width{id: 419}} 2015-03-10 15:50:09.674 Cookila copy[5779:607] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '{ Rows: UILayoutContainerView:0x7b6505a0.Height{id: 118} == 960 + 1*0x7b7679b0.marker{id: 49} + 2*0x7b638350.marker{id: 135} UILayoutContainerView:0x7b6505a0.Width{id: 115} == 640 + 1*0x7b767980.marker{id: 46} + 2*0x7b6592b0.marker{id: 131} UILayoutContainerView:0x7b6505a0.minX{id: 121} == 0 + 2*0x7b642e00.marker{id: 130} + -1*0x7b6592b0.marker{id: 131} UILayoutContainerView:0x7b6505a0.minY{id: 122} == 0 + 2*0x7b657350.marker{id: 134} + -1*0x7b638350.marker{id: 135} UINavigationTransitionView:0x7b756bc0.Height{id: 110} == 960 + 1*0x7b7679b0.marker{id: 49} + 2*0x7b664d50.marker{id: 119} + 2*0x7b638350.marker{id: 135} UINavigationTransitionView:0x7b756bc0.Width{id: 107} == 640 + 1*0x7b767980.marker{id: 46} + 2*0x7b664cf0.marker{id: 116} + 2*0x7b6592b0.marker{id: 131} UINavigationTransitionView:0x7b756bc0.minX{id: 113} == 0 + 2*0x7b6584c0.marker{id: 112} + -1*0x7b664cf0.marker{id: 116} UINavigationTransitionView:0x7b756bc0.minY{id: 114} == 0 + 2*0x7b664d20.marker{id: 117} + -1*0x7b664d50.marker{id: 119} UIViewControllerWrapperView:0x7b77add0.Height{id: 102} == 960 + 1*0x7b7679b0.marker{id: 49} + 2*0x7b659c40.marker{id: 111} + 2*0x7b664d50.marker{id: 119} + 2*0x7b638350.marker{id: 135} UIViewControllerWrapperView:0x7b77add0.Width{id: 99} == 640 + 1*0x7b767980.marker{id: 46} + 2*0x7b655430.marker{id: 108} + 2*0x7b664cf0.marker{id: 116} + 2*0x7b6592b0.marker{id: 131} UIViewControllerWrapperView:0x7b77add0.minX{id: 105} == 0 + 2*0x7b655400.marker{id: 104} + -1*0x7b655430.marker{id: 108} UIViewControllerWrapperView:0x7b77add0.minY{id: 106} == 0 + 2*0x7b659c10.marker{id: 109} + -1*0x7b659c40.marker{id: 111} UIWindow:0x7b742a60.Height{id: 45} == 960 + 1*0x7b7679b0.marker{id: 49} UIWindow:0x7b742a60.Width{id: 42} == 640 + 1*0x7b767980.marker{id: 46} UIWindow:0x7b742a60.minX{id: 41} == 0 + 2*0x7b767710.marker{id: 40} + -0.5*0x7b767980.marker{id: 46} UIWindow:0x7b742a60.minY{id: 44} == 0 + 2*0x7b767840.marker{id: 43} + -0.5*0x7b7679b0.marker{id: 49} objective{id: 1} == {objective 0x7b84c960:  + *UIButton:0x7b6299c0.Width{id: 408} + *UIButton:0x7b661ad0.Width{id: 385} + *UIButton:0x7b7780a0.Width{id: 388} + *UIView:0x7b6547d0.Width{id: 419}} Constraints:  Marker:0x7b638350.marker{id: 135}  Marker:0x7b642e00.marker{id: 130}  Marker:0x7b655400.marker{id: 104}  Marker:0x7b655430.marker{id: 108}  Marker:0x7b657350.marker{id: 134}  Marker:0x7b6584c0.marker{id: 112}  Marker:0x7b6592b0.marker{id: 131}  Marker:0x7b659c10.marker{id: 109}  Marker:0x7b659c40.marker{id: 111}  Marker:0x7b664cf0.marker{id: 116}  Marker:0x7b664d20.marker{id: 117}  Marker:0x7b664d50.marker{id: 119}  Marker:0x7b767980.marker{id: 46}  Marker:0x7b7679b0.marker{id: 49}  Marker:0x7b767710.marker{id: 40}  Marker:0x7b767840.marker{id: 43} Integralization Adjustments: (none) Statistics: 16 rows. Variable counts: 1 -> 2 2 -> 10 3 -> 2 4 -> 2 }: internal error. Cannot find an outgoing row head for incoming head UIButton:0x7b7780a0.Width{id: 388}, which should never happen.' *** First throw call stack: ( 0 CoreFoundation 0x03e051e4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x03b848e5 objc_exception_throw + 44 2 CoreFoundation 0x03e04fbb +[NSException raise:format:] + 139 3 Foundation 0x035b4079 -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 256 4 Foundation 0x035b3ee3 -[NSISEngine optimize] + 183 5 Foundation 0x037286d8 -[NSISEngine withBehaviors:performModifications:] + 183 6 Foundation 0x035b83c5 -[NSISEngine withAutomaticOptimizationDisabled:] + 48 7 UIKit 0x02695830 -[UIView(Hierarchy) _postMovedFromSuperview:] + 313 8 UIKit 0x026a0dd4 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1875 9 UIKit 0x02693c4f -[UIView(Hierarchy) insertSubview:atIndex:] + 64 10 UIKit 0x02628089 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1896 11 UIKit 0x0269a81f +[UIView(Animation) performWithoutAnimation:] + 82 12 UIKit 0x026274f6 -[_UINavigationParallaxTransition animateTransition:] + 1155 13 UIKit 0x0276e3ae -[UINavigationController _startCustomTransition:] + 3446 14 UIKit 0x0277a8f7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688 15 UIKit 0x0277b4e9 -[UINavigationController __viewWillLayoutSubviews] + 57 16 UIKit 0x028bc0d1 -[UILayoutContainerView layoutSubviews] + 213 17 UIKit 0x026a3964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355 18 libobjc.A.dylib 0x03b9682b -[NSObject performSelector:withObject:] + 70 19 QuartzCore 0x0250845a -[CALayer layoutSublayers] + 148 20 QuartzCore 0x024fc244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 21 QuartzCore 0x024fc0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 22 QuartzCore 0x024627fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 23 QuartzCore 0x02463b85 _ZN2CA11Transaction6commitEv + 393 24 QuartzCore 0x02464258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 25 CoreFoundation 0x03dcd36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 26 CoreFoundation 0x03dcd2bf __CFRunLoopDoObservers + 399 27 CoreFoundation 0x03dab254 __CFRunLoopRun + 1076 28 CoreFoundation 0x03daa9d3 CFRunLoopRunSpecific + 467 29 CoreFoundation 0x03daa7eb CFRunLoopRunInMode + 123 30 GraphicsServices 0x0585b5ee GSEventRunModal + 192 31 GraphicsServices 0x0585b42b GSEventRun + 104 32 UIKit 0x02634f9b UIApplicationMain + 1225 33 Cookila copy 0x0008a0fd main + 141 34 libdyld.dylib 0x048276d9 start + 1 35 ??? 0x00000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException 

self.view recursiveDescription(在ViewWillAppear的断点上运行之前运行):

 <UIView: 0x7b67d660; frame = (0 0; 320 480); autoresize = W+H; layer = > | <UIImageView: 0x7b67cfb0; frame = (0 0; 320 568); opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = > | <UIButton: 0x7b674310; frame = (160 515; 75 30); opaque = NO; autoresize = RM+BM; tag = 115; layer = > | <UIButton: 0x7b67ecf0; frame = (235 515; 75 30); opaque = NO; autoresize = RM+BM; tag = 116; layer = > | <UIButton: 0x7b67ccd0; frame = (85 515; 75 30); opaque = NO; autoresize = RM+BM; tag = 114; layer = > | <UIButton: 0x7b6764c0; frame = (10 455; 75 60); opaque = NO; autoresize = RM+BM; tag = 13; layer = > | <UIButton: 0x7b6745d0; frame = (85 455; 75 60); opaque = NO; autoresize = RM+BM; tag = 14; layer = > | <UIButton: 0x7b67f1f0; frame = (160 455; 75 60); opaque = NO; autoresize = RM+BM; tag = 15; layer = > | <UIButton: 0x7b67c890; frame = (10 515; 75 30); opaque = NO; autoresize = RM+BM; tag = 113; layer = > | <UIButton: 0x7b672dc0; frame = (235 455; 75 60); opaque = NO; autoresize = RM+BM; tag = 16; layer = > | <UIView: 0x7b67d520; frame = (0 428; 320 27); autoresize = RM+BM; layer = > | <UIButton: 0x7b67f430; frame = (160 398; 75 30); opaque = NO; autoresize = RM+BM; tag = 111; layer = > | <UIButton: 0x7b6733f0; frame = (235 398; 75 30); opaque = NO; autoresize = RM+BM; tag = 112; layer = > | <UIButton: 0x7b675850; frame = (85 398; 75 30); opaque = NO; autoresize = RM+BM; tag = 110; layer = > | <UIButton: 0x7b656330; frame = (10 338; 75 60); opaque = NO; autoresize = RM+BM; tag = 9; layer = > | <UIButton: 0x7b6753a0; frame = (85 338; 75 60); opaque = NO; autoresize = RM+BM; tag = 10; layer = > | <UIButton: 0x7b6737f0; frame = (160 338; 75 60); opaque = NO; autoresize = RM+BM; tag = 11; layer = > | <UIButton: 0x7b6762e0; frame = (10 398; 75 30); opaque = NO; autoresize = RM+BM; tag = 109; layer = > | <UIButton: 0x7b675ba0; frame = (235 338; 75 60); opaque = NO; autoresize = RM+BM; tag = 12; layer = > | <UIView: 0x7b67d3d0; frame = (0 311; 320 27); autoresize = RM+BM; layer = > | <UIButton: 0x7b675d50; frame = (160 281; 75 30); opaque = NO; autoresize = RM+BM; tag = 107; layer = > | <UIButton: 0x7b663970; frame = (235 281; 75 30); opaque = NO; autoresize = RM+BM; tag = 108; layer = > | <UIButton: 0x7b675580; frame = (85 281; 75 30); opaque = NO; autoresize = RM+BM; tag = 106; layer = > | <UIButton: 0x7b665a00; frame = (10 221; 75 60); opaque = NO; autoresize = RM+BM; tag = 5; layer = > | <UIButton: 0x7b67ca90; frame = (85 221; 75 60); opaque = NO; autoresize = RM+BM; tag = 6; layer = > | <UIButton: 0x7b674150; frame = (160 221; 75 60); opaque = NO; autoresize = RM+BM; tag = 7; layer = > | <UIButton: 0x7b6734e0; frame = (10 281; 75 30); opaque = NO; autoresize = RM+BM; tag = 105; layer = > | <UIButton: 0x7b67efb0; frame = (235 221; 75 60); opaque = NO; autoresize = RM+BM; tag = 8; layer = > | <UIButton: 0x7b67f700; frame = (160 164; 75 30); opaque = NO; autoresize = RM+BM; tag = 103; layer = > | <UIButton: 0x7b676020; frame = (235 164; 75 30); opaque = NO; autoresize = RM+BM; tag = 104; layer = > | <UIButton: 0x7b676700; frame = (85 164; 75 30); opaque = NO; autoresize = RM+BM; tag = 102; layer = > | <UIButton: 0x7b67eab0; frame = (10 104; 75 60); opaque = NO; autoresize = RM+BM; tag = 1; layer = > | <UIButton: 0x7b674810; frame = (85 104; 75 60); opaque = NO; autoresize = RM+BM; tag = 2; layer = > | <UIButton: 0x7b674a50; frame = (10 164; 75 30); opaque = NO; autoresize = RM+BM; tag = 101; layer = > | <UIButton: 0x7b642bd0; frame = (235 104; 75 60); opaque = NO; autoresize = RM+BM; tag = 4; layer = > | <UIView: 0x7b67d1f0; frame = (0 194; 320 27); autoresize = RM+BM; layer = > | <UIButton: 0x7b675060; frame = (160 104; 75 60); opaque = NO; autoresize = RM+BM; tag = 3; layer = > | <UIButton: 0x7b67b7f0; frame = (258 20; 46 30); opaque = NO; autoresize = RM+BM; layer = > | <_UILayoutGuide: 0x7b67d790; frame = (0 0; 0 0); hidden = YES; layer = > | <_UILayoutGuide: 0x7b67c0a0; frame = (0 0; 0 0); hidden = YES; layer = > 

显然,违规的UIButton位于ViewController中,我们走出(!)而不是在转换中创建的那个。

不知道为什么….

无论如何 – 有问题的约束是4:3的比例约束……