iOS纵横比约束在iOS7上中断,在iOS8上工作

iOS纵横比约束在iOS7上中断,在iOS8上工作,ios,autolayout,Ios,Autolayout,在我的应用程序中,我设置了一个UIView的约束,通过使用纵横比约束从其宽度计算其高度。它在iOS8上的每种设备屏幕大小(3.5、4、4.7、5.5)都能完美工作,但它会导致应用程序在每一台iOS7设备上崩溃 我假设它是纵横比约束,因为如果我用固定高度约束替换它,它就不会崩溃(显然在某些设备上看起来很糟糕) 堆栈跟踪非常长,所以我只复制它的一部分 提前感谢您的帮助 Objective: {objective 0x7f9d90da33c0: <750:4692, 251:2936, 250:

在我的应用程序中,我设置了一个UIView的约束,通过使用纵横比约束从其宽度计算其高度。它在iOS8上的每种设备屏幕大小(3.5、4、4.7、5.5)都能完美工作,但它会导致应用程序在每一台iOS7设备上崩溃

我假设它是纵横比约束,因为如果我用固定高度约束替换它,它就不会崩溃(显然在某些设备上看起来很糟糕)

堆栈跟踪非常长,所以我只复制它的一部分

提前感谢您的帮助

Objective: {objective 0x7f9d90da33c0: <750:4692, 251:2936, 250:367> + <251:-1>*0x7f9d90c06220.marker{id: 592} + <251:-1>*0x7f9d90c24420.marker{id: 599} + <251:-1>*0x7f9d90c25650.marker{id: 594} + <251:-1>*0x7f9d90c27ad0.marker{id: 597} + <750:-1>*0x7f9d90c3b270.marker{id: 483} + <250:-3.9875>*0x7f9d90c43e40.marker{id: 618} + <250:-3.9875>*0x7f9d90c43e90.marker{id: 620} + <750:-4>*0x7f9d90c442e0.marker{id: 479} + <251:1>*0x7f9d90c464b0.marker{id: 485} + <251:-1>*0x7f9d90c46bf0.marker{id: 504} + <251:-1>*0x7f9d90c46c90.marker{id: 508} + <251:-1>*0x7f9d90c46ce0.marker{id: 510} + <251:-1>*0x7f9d90c46d80.marker{id: 514} + <251:-2>*0x7f9d90c4aa60.marker{id: 623} + <251:-2>*0x7f9d90c4aab0.marker{id: 625} + <251:-2, 250:-3.9875>*0x7f9d90c4ab50.marker{id: 631} + <251:-2, 250:-3.9875>*0x7f9d90c4abf0.marker{id: 634} + <251:4, 250:3.9875>*0x7f9d90c4ac40.marker{id: 637} + <251:4, 250:3.9875>*0x7f9d90c4ac90.marker{id: 642} + <750:1, 251:1>*0x7f9d90c4c530.negError{id: 645} + <750:1, 251:1>*0x7f9d90c4cb20.posErrorMarker{id: 646} + <750:1, 251:1>*0x7f9d90c530f0.negError{id: 649} + <750:1, 251:1>*0x7f9d90c53150.negError{id: 651} + <750:1, 250:1>*0x7f9d90c53820.posErrorMarker{id: 652} + <750:1, 250:1>*0x7f9d90c538a0.posErrorMarker{id: 654} + <750:1, 250:1>*0x7f9d90c53fd0.posErrorMarker{id: 656} + <750:1, 250:1>*0x7f9d90c54070.posErrorMarker{id: 658} + <750:1, 251:1>*0x7f9d90c54650.negError{id: 661} + <750:1>*0x7f9d90c546b0.negError{id: 663} + <251:1>*0x7f9d90c546b0.posErrorMarker{id: 662} + <750:1>*0x7f9d90c55230.negError{id: 665} + <251:1>*0x7f9d90c55230.posErrorMarker{id: 664} + <750:1, 251:1>*0x7f9d90c552b0.negError{id: 667} + <750:1, 251:1>*0x7f9d90d34300.posErrorMarker{id: 916} + <750:1>*0x7f9d90de48a0.marker{id: 738} + <250:-1>*0x7f9d90de48f0.marker{id: 740} + <250:-1>*0x7f9d90de4940.marker{id: 744} + <750:1>*0x7f9d90de4990.marker{id: 745} + <750:1>*0x7f9d90de4c70.marker{id: 718} + <750:1>*0x7f9d90de4cc0.marker{id: 720} + <250:-1
[代码>目标:<代码>目标::{目标:{目标:0x7F9F9F9F9F9F9F9F9D9D9D99F9F9F999D999D90代码>目标::{目标:{目标:{目标:{目标。目标:{目标:0x7代码:0x77F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9D9D9F9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D90D9.3.3.3333{id:479}+*0x7f9d90c464b0.标记{id:485}2008年7 F99F99F99F9D99D90C466C46 6 C90。标记物.标记物.标记物(id:id:508 5 5 5 9 9 9 9 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 9 9 9 9 9 9 F9F9F9F9F9F9D9D9 9 9 9 9 9 D9 9 9 9 9 D9 9 9 9 9 9 D9 9 9 9 9 D9 9 9 C46 C46 6 6 6 6 6 6 6 C6 6 6 6 6 6 6 6 6 C0 0 0 0 0 0 0 0 0 0 0 0 0 0 0。9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 AC40.标记{id:637}+*0x7f9d90c4ac90.标记{id:642}10.7F99F99F99F99D999D99D99D90C4CB20.PosT9 9.PosErrorMarkRoRoRoRoRoRoRoRoRoRoRoRoRoID:646.7 7 7 7.77F9F9F99D9D9D9D99D9D99D9D9D9D9D9D9D9D9CCC9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9.5 5 5 5 C5C55 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.7.7.7 7 7 7 7 7 7 7.7 7 7 7 7 7 7 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9}+*0x7f9d90c54650.negError[id:663},[id:661{id:661}{{id:661{{{id:id:661{{{id:661{{{id:661{{id:661{{{id:661{{{id:661{{id:id:661{id:id:663{id:id:663}{id:id:663{7 7F9F99D9D905 C5C546C546C5465}.pos错误标记.pos错误标记.pos错误标记.pos错误标记.pos错误标记.pos错误标记..错误错误错误人士{{{id:id:id:id:id:id:662}.id:662}.id:662}.id:662}id:662}}id:662},,{{{id:民民民民民民民民民民民民民民民民民民民民民{id:740}+*0x7f9d90de4940.标记{id:744}+*0x7f9d90de4990.标记{id:745}+*0x7f9d90de4c70.标记{id:718}+*0x7f9d90de4cc0.标记{id:720}+0.132066 0x7f9d93042c70.标记{id:546}[]->1.000000 0x7f9d93042d60.标记{id:552}[]->-1.000000 0x7f9d93042db0.标记{id:554}[]->1.000000 0x7f9d93042ea0.标记{id:562}[]->-1.000000 0x7f9d930431c0.标记{id:581}[]->1.000000 统计数字: 195行。可变计数: 1 -> 59 2 -> 28 3 -> 3 4 -> 7 5 -> 4 6 -> 3 7 -> 3 8 -> 4 9 -> 8 10 -> 10 11 -> 11 12 -> 10 13 -> 7 14 -> 2 15 -> 3 16 -> 10 17 -> 17 18 -> 6 }:内部错误。找不到传入标头UIView:0x7f9d930332a0的传出行标头。高度{id:981},这不应发生。' ***第一次抛出调用堆栈: ( 0 CoreFoundation 0x000000011284d495例外预处理+165 1 libobjc.A.dylib 0x0000000112200699e objc_异常_抛出+43 2 CoreFoundation 0x000000011284d2ad+[N异常提升:格式:][205 3基金会0x000 000 01DFB054—[ NSISEngEngEngimiEngestStIn ObjutoWORKOVENHOVER:] + 178 4基金会0x000 000 01DFAF22- [ NSISEngEngress优化] + 147 5基金会0x000 000 0110 F432 E3 - [ NSISEngulee附带行为:PrimultExp修改:] + 192 6 UIKit 0x000000011126f889-[UIView(层次结构)\u postMovedFromSuperview:+321 7 UIKit 0x000000011126 DF42\uu UIVIEW已从SuperView+206中删除 8 UIKit 0x000000011126 DB9E-[UIView(层次结构)从SuperView移除]+218 9 UIKit 0x000000011130069-[UINavigationController导航转换视图:didEndTransition:fromView:toView:+320 10 UIKit 0x0000000111328fdd\uuuu49-[UINavigationController\uStartCustomTransition:]\uBlock\uInvoke+138 11 UIKit 0x000000011187ec2a-[\u UIViewControllerTransitionContext completeTransition:][78 12 UIKit 0x000000011211DA4 uuu 53-[\uUINAVIgationParallaxTransition animateTransition:][\u块调用103+605 13 UIKit 0x00000001112746e8-[UIViewAnimationBlockDelegate\u DiEndBlockAnimation:finished:context:+299 14 UIKit 0x000000011126068e-[UIViewAnimationState sendDelegateAnimationDidStop:finished:+235 15 UIKit 0x0000000111260941-[UIViewAnimationState animationDidStop:finished:+78 16 UIKit 0x000000011ef6d4b7-[UIViewAnimationStateAccessability(安全类别)animationDidStop:finished:+48 17 QuartzCore 0x0000000110ac9134\u ZN2CA5layer23运行\u动画\u callbacksEPv+310 18 libdispatch.dylib 0x000000011327772d_dispatch_client_callout+8 19 libdispatch.dylib 0x00000001132673fc_调度_主队列_回调_4CF+354 20 CoreFoundation 0x00000001128ab289\uuu CFRUNLOOP\u正在维护\u主\u调度\u队列\uuu9 21 CoreFoundation 0x00000001127f8854\uuu CFRunLoopRun+1764 22 CoreFoundation 0x00000001127f7d83 CFRunLoopRunSpecific+467 23图形服务0x0000000114223f04 GSEventRunModal+161 24 UIKit 0x0000000111121BE33 UIApplicationMain+1010 25播放聊天0x000000010fa89513主+115 26 libdyld.dylib 0x00000001134fa5c9开始+1 ) libc++abi.dylib:以NSException类型的未捕获异常终止
我用以下方法解决了这个问题:

假设我
 Integralization Adjustments:
0x7f9d93042a90.marker{id: 532} [<NSLayoutConstraint:0x7f9d93042a90 UIView:0x7f9d9303d590.width == 1.50943*UIView:0x7f9d9303d590.height>] -> 0.132066
0x7f9d93042c70.marker{id: 546} [<NSLayoutConstraint:0x7f9d93042c70 UIButton:0x7f9d90de27a0.height == UIButton:0x7f9d93018ab0.height>] -> 1.000000
0x7f9d93042d60.marker{id: 552} [<NSLayoutConstraint:0x7f9d93042d60 UIButton:0x7f9d9303dbf0.width == UIButton:0x7f9d93018ab0.width>] -> -1.000000
0x7f9d93042db0.marker{id: 554} [<NSLayoutConstraint:0x7f9d93042db0 UIButton:0x7f9d9303dbf0.height == UIButton:0x7f9d93033b40.height>] -> 1.000000
0x7f9d93042ea0.marker{id: 562} [<NSLayoutConstraint:0x7f9d93042ea0 UIButton:0x7f9d93033b40.width == UIButton:0x7f9d9303c500.width>] -> -1.000000
0x7f9d930431c0.marker{id: 581} [<NSLayoutConstraint:0x7f9d930431c0 UIButton:0x7f9d9303c500.height == UIButton:0x7f9d93045880.height>] -> 1.000000

  Statistics:
    195 rows. Variable counts:
          1 ->  59
          2 ->  28
          3 ->   3
          4 ->   7
          5 ->   4
          6 ->   3
          7 ->   3
          8 ->   4
          9 ->   8
         10 ->  10
         11 ->  11
         12 ->  10
         13 ->   7
         14 ->   2
         15 ->   3
         16 ->  10
         17 ->  17
         18 ->   6
}: internal error.  Cannot find an outgoing row head for incoming head UIView:0x7f9d930332a0.Height{id: 981}, which should never happen.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000011284d495 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000011220699e objc_exception_throw + 43
    2   CoreFoundation                      0x000000011284d2ad +[NSException raise:format:] + 205
    3   Foundation                          0x0000000110dfb054 -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 178
    4   Foundation                          0x0000000110dfaf22 -[NSISEngine optimize] + 147
    5   Foundation                          0x0000000110f432e3 -[NSISEngine withBehaviors:performModifications:] + 192
    6   UIKit                               0x000000011126f889 -[UIView(Hierarchy) _postMovedFromSuperview:] + 321
    7   UIKit                               0x000000011126df42 __UIViewWasRemovedFromSuperview + 206
    8   UIKit                               0x000000011126db9e -[UIView(Hierarchy) removeFromSuperview] + 218
    9   UIKit                               0x0000000111330069 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 320
    10  UIKit                               0x0000000111328fdd __49-[UINavigationController _startCustomTransition:]_block_invoke + 138
    11  UIKit                               0x000000011187ec2a -[_UIViewControllerTransitionContext completeTransition:] + 78
    12  UIKit                               0x0000000111211da4 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke103 + 605
    13  UIKit                               0x00000001112746e8 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 299
    14  UIKit                               0x000000011126068e -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 235
    15  UIKit                               0x0000000111260941 -[UIViewAnimationState animationDidStop:finished:] + 78
    16  UIKit                               0x000000011ef6d4b7 -[UIViewAnimationStateAccessibility(SafeCategory) animationDidStop:finished:] + 48
    17  QuartzCore                          0x0000000110ac9134 _ZN2CA5Layer23run_animation_callbacksEPv + 310
    18  libdispatch.dylib                   0x000000011327772d _dispatch_client_callout + 8
    19  libdispatch.dylib                   0x00000001132673fc _dispatch_main_queue_callback_4CF + 354
    20  CoreFoundation                      0x00000001128ab289 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    21  CoreFoundation                      0x00000001127f8854 __CFRunLoopRun + 1764
    22  CoreFoundation                      0x00000001127f7d83 CFRunLoopRunSpecific + 467
    23  GraphicsServices                    0x0000000114223f04 GSEventRunModal + 161
    24  UIKit                               0x000000011121be33 UIApplicationMain + 1010
    25  Playchat                            0x000000010fa89513 main + 115
    26  libdyld.dylib                       0x00000001134fa5c9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
NSLayoutConstraint(item: BT_Facebook,
              attribute: NSLayoutAttribute.Width,
              relatedBy: .Equal,
                 toItem: nil,
              attribute: .Width,
             multiplier: 0.2,
               constant: sizeBtRedeSociais)
var sizeBtRedeSociais = UIScreen.mainScreen().bounds.width / 5
var BT_FacebookWidth = NSLayoutConstraint(item: BT_Facebook, attribute: NSLayoutAttribute.Width, relatedBy: .Equal, toItem: nil, attribute: .Width, multiplier: 1, constant: sizeBtRedeSociais)
var BT_TwitterWidth = NSLayoutConstraint(item: BT_Twitter, attribute: NSLayoutAttribute.Width, relatedBy: .Equal, toItem: nil, attribute: .Width, multiplier: 1, constant: sizeBtRedeSociais)
var BT_InstagramWidth = NSLayoutConstraint(item: BT_Instagram, attribute: NSLayoutAttribute.Width, relatedBy: .Equal, toItem: nil, attribute: .Width, multiplier: 1, constant: sizeBtRedeSociais)
var BT_GoogleWidth = NSLayoutConstraint(item: BT_Google, attribute: NSLayoutAttribute.Width, relatedBy: .Equal, toItem: nil, attribute: .Width, multiplier: 1, constant: sizeBtRedeSociais)
var BT_YoutubeWidth = NSLayoutConstraint(item: BT_Youtube, attribute: NSLayoutAttribute.Width, relatedBy: .Equal, toItem: nil, attribute: .Width, multiplier: 1, constant: sizeBtRedeSociais)
 DISPLAY_SCALE = UIScreen.mainScreen().bounds.width / 375