ios7中NSISEngine的swift autolayout崩溃

时间:2014-08-26 04:03:25

标签: swift autolayout

转换回来时崩溃自动布局的最小测试用例。这不是一个问题,而是对他人的警告,因为在经过谷歌搜索后我无法找到任何明确的信息。

https://github.com/delackner/SwiftAutolayoutCrash

运行应用程序,然后按GO两次(通过pushViewController进行转换) 然后按BACK两次(通过popViewController转换)

在IOS7.1.1和IOS7.1.2 设备上崩溃非常可怕,而不是在模拟器上崩溃。

有意义的部分全部在ViewController.swift

对我来说有趣并且让我想邀请讨论的是,这在IOS7模拟器和ios8模拟器上工作正常,没有警告,没有控制台警告输出,但在实际设备上崩溃真的很难。

转载如下:

override func viewDidLoad() {
    super.viewDidLoad()

    // Disable this line to get a sense of the navigation transitions
    self.view.backgroundColor = UIColor.whiteColor()

    let (add, views) = makeAdder(self.view)

    let iconFrame = UIView.newAutoLayoutView()
    add(iconFrame, "iconFrame")
    fillIconFrame(iconFrame)

    let bOK = UIButton.buttonWithType(.System) as UIButton
    bOK.addTarget(self, action: Selector("next:"), forControlEvents: .TouchUpInside)
    bOK.setTitle("GO", forState: .Normal)
    add(bOK, "ok")

    let l = UILabel.newAutoLayoutView()
    add(l, "text")
    l.text = "To Crash: Press GO At least twice, then back twice"
    l.autoCenterInSuperview()

    //THIS WORKS FINE
    //l.autoSetDimension(.Width, toSize: self.view.frame.size.width * 0.8)

    //THIS CRASHES
    l.autoMatchDimension(.Width, toDimension: .Width, ofView: self.view, withMultiplier: 0.8)

    VFL(self.view, "V:[iconFrame][text][ok]", .AlignAllCenterX, nil, views)

    iconFrame.autoMatchDimension(.Width, toDimension: .Width, ofView: l)
    bOK.autoMatchDimension(.Width, toDimension: .Width, ofView: l)
}

func next(sender:AnyObject) {
    self.navigationController.pushViewController(TestViewController(), animated: true)
}

错误输出:

2014-08-26 12:39:29.106 Crash[1420:60b] Objective: {objective 0x178034360: <250:1305> + <250:-1>*0x170093100.marker{id: 236} + <250:1>*0x170093330.marker{id: 267} + <250:-1>*0x170093560.marker{id: 244} + <250:1>*0x170096620.marker{id: 270} + <250:-1>*0x170096d50.marker{id: 240} + <250:-1>*0x170096da0.marker{id: 242} + <750:1, 250:-2>*0x1780ba700.negError{id: 297} + <250:3>*0x1780ba700.posErrorMarker{id: 296} + <750:1>*0x1780baac0.negError{id: 299} + <250:1>*0x1780baac0.posErrorMarker{id: 298} + <750:1, 250:1>*0x1780bad60.negError{id: 288} + <750:1, 250:1>*0x1780bae80.negError{id: 293} + <750:1>*0x1780baee0.negError{id: 290} + <250:1>*0x1780baee0.posErrorMarker{id: 289} + <750:1>*0x1780bb300.negError{id: 295} + <250:1>*0x1780bb300.posErrorMarker{id: 294} + <250:-1.19209e-07>*0x1780bba20.negError{id: 403}}
2014-08-26 12:39:29.127 Crash[1420:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<NSISEngine: 0x178121860>{ Rows:
    0x1780bad60.posErrorMarker{id: 287} == 585 + -1*0x170093100.marker{id: 236} + -1*0x170096d50.marker{id: 240} + -1*0x170096da0.marker{id: 242} + -1*0x170093560.marker{id: 244} + 1*0x170093330.marker{id: 267} + 1*0x1780bad60.negError{id: 288} + 1*0x1780ba700.posErrorMarker{id: 296} + -1*0x1780ba700.negError{id: 297}
    0x1780bae80.posErrorMarker{id: 292} == 720 + 1*0x170096620.marker{id: 270} + 1*0x1780bae80.negError{id: 293} + 1*0x1780ba700.posErrorMarker{id: 296} + -1*0x1780ba700.negError{id: 297}
    UIButton:0x15c618a20.Height{id: 266} == 60 + 1*0x1780bb300.posErrorMarker{id: 294} + -1*0x1780bb300.negError{id: 295}
    UIButton:0x15c618a20.Width{id: 265} == 780 + 1*0x170096620.marker{id: 270} + 1*0x1780ba700.posErrorMarker{id: 296} + -1*0x1780ba700.negError{id: 297}
    UIButton:0x15c618a20.minX{id: 264} == 98 + 1*0x170093740.marker{id: 253} + -1.25*0x170093d30.marker{id: 255} + -1*0x170093600.marker{id: 263} + -0.5*0x170096620.marker{id: 270} + 0.125*0x1780ba700.posErrorMarker{id: 296} + -0.125*0x1780ba700.negError{id: 297}
    UIButton:0x15c618a20.minY{id: 260} == 21 + 1*0x170093fb0.marker{id: 247} + 0.5*UIView:0x170170bc0.Height{id: 252} + 1*0x170093f10.marker{id: 259} + 0.5*0x1780baac0.posErrorMarker{id: 298} + -0.5*0x1780baac0.negError{id: 299}
    UILabel:0x15c603eb0.Height{id: 291} == 42 + 1*0x1780baee0.posErrorMarker{id: 289} + -1*0x1780baee0.negError{id: 290}
    UILabel:0x15c603eb0.Width{id: 246} == 683 + -1*0x170093100.marker{id: 236} + -1*0x170096d50.marker{id: 240} + -1*0x170096da0.marker{id: 242} + -1*0x170093560.marker{id: 244} + 1*0x170093330.marker{id: 267} + 1*0x1780ba700.posErrorMarker{id: 296} + -1*0x1780ba700.negError{id: 297}
    UILabel:0x15c603eb0.minX{id: 243} == 96 + 1*0x170093100.marker{id: 236} + 1*0x170096d50.marker{id: 240} + 1*0x170096da0.marker{id: 242}
    UILabel:0x15c617f50.Height{id: 251} == 42 + 1*0x1780baac0.posErrorMarker{id: 298} + -1*0x1780baac0.negError{id: 299}
    UILabel:0x15c617f50.Width{id: 249} == 780 + 1*0x1780ba700.posErrorMarker{id: 296} + -1*0x1780ba700.negError{id: 297}
    UILabel:0x15c617f50.minX{id: 248} == 98 + 1*0x170093740.marker{id: 253} + -1.25*0x170093d30.marker{id: 255} + 0.125*0x1780ba700.posErrorMarker{id: 296} + -0.125*0x1780ba700.negError{id: 297}
    UILabel:0x15c617f50.minY{id: 250} == -21 + 1*0x170093fb0.marker{id: 247} + 0.5*UIView:0x170170bc0.Height{id: 252} + -0.5*0x1780baac0.posErrorMarker{id: 298} + 0.5*0x1780baac0.negError{id: 299}
    UILayoutContainerView:0x1701a79a0.Height{id: 94} == 2048 + 2*0x178094e10.marker{id: 105} + 1*0x1780951d0.marker{id: 113}
    UILayoutContainerView:0x1701a79a0.Width{id: 89} == 1543 + 2*0x178094d70.marker{id: 100} + 1*0x178095180.marker{id: 110}
    UILayoutContainerView:0x1701a79a0.minX{id: 97} == 0 + 2*0x178094d20.marker{id: 96} + -1*0x178094d70.marker{id: 100}
    UILayoutContainerView:0x1701a79a0.minY{id: 98} == 0 + 2*0x178094dc0.marker{id: 103} + -1*0x178094e10.marker{id: 105}
    UINavigationTransitionView:0x1701e1c00.Height{id: 84} == 2048 + 2*0x1780949b0.marker{id: 95} + 2*0x178094e10.marker{id: 105} + 1*0x1780951d0.marker{id: 113}
    UINavigationTransitionView:0x1701e1c00.Width{id: 79} == 1539 + 2*0x178094910.marker{id: 90} + 2*0x178094d70.marker{id: 100} + 1*0x178095180.marker{id: 110}
    UINavigationTransitionView:0x1701e1c00.minX{id: 87} == 0 + 2*0x1780948c0.marker{id: 86} + -1*0x178094910.marker{id: 90}
    UINavigationTransitionView:0x1701e1c00.minY{id: 88} == 0 + 2*0x178094960.marker{id: 93} + -1*0x1780949b0.marker{id: 95}
    UIView:0x170170bc0.Width{id: 254} == 976 + -2.5*0x170093d30.marker{id: 255} + 1.25*0x1780ba700.posErrorMarker{id: 296} + -1.25*0x1780ba700.negError{id: 297}
    UIView:0x170171340.Height{id: 239} == 96 + 1*0x170093060.marker{id: 238}
    UIView:0x170171340.Width{id: 237} == 96 + 1*0x170093100.marker{id: 236}
    UIView:0x170171340.minX{id: 241} == 0 + 1*0x170096d50.marker{id: 240}
    UIView:0x170171640.Width{id: 245} == 779 + 1*0x170093330.marker{id: 267} + 1*0x1780ba700.posErrorMarker{id: 296} + -1*0x1780ba700.negError{id: 297}
    UIView:0x170171640.minX{id: 262} == 98 + 1*0x170093740.marker{id: 253} + -1.25*0x170093d30.marker{id: 255} + 1*0x1700937e0.marker{id: 261} + -0.5*0x170093330.marker{id: 267} + 0.125*0x1780ba700.posErrorMarker{id: 296} + -0.125*0x1780ba700.negError{id: 297}
    UIView:0x170171640.minY{id: 258} == -21 + 1*0x170093fb0.marker{id: 247} + 0.5*UIView:0x170170bc0.Height{id: 252} + -1*0x170093dd0.marker{id: 256} + -1*UIView:0x170171640.Height{id: 257} + -0.5*0x1780baac0.posErrorMarker{id: 298} + 0.5*0x1780baac0.negError{id: 299}
    UIViewControllerWrapperView:0x178170140.Height{id: 74} == 2048 + 2*0x178094550.marker{id: 85} + 2*0x1780949b0.marker{id: 95} + 2*0x178094e10.marker{id: 105} + 1*0x1780951d0.marker{id: 113}
    UIViewControllerWrapperView:0x178170140.Width{id: 69} == 1534 + 2*0x1780944b0.marker{id: 80} + 2*0x178094910.marker{id: 90} + 2*0x178094d70.marker{id: 100} + 1*0x178095180.marker{id: 110}
    UIViewControllerWrapperView:0x178170140.minX{id: 77} == 0 + 2*0x178094460.marker{id: 76} + -1*0x1780944b0.marker{id: 80}
    UIViewControllerWrapperView:0x178170140.minY{id: 78} == 0 + 2*0x178094500.marker{id: 83} + -1*0x178094550.marker{id: 85}
    UIWindow:0x15c50b0e0.Height{id: 104} == 2048 + 1*0x1780951d0.marker{id: 113}
    UIWindow:0x15c50b0e0.Width{id: 99} == 1536 + 1*0x178095180.marker{id: 110}
    UIWindow:0x15c50b0e0.minX{id: 107} == 0 + 2*0x1780bb3c0.marker{id: 106} + -0.5*0x178095180.marker{id: 110}
    UIWindow:0x15c50b0e0.minY{id: 109} == 0 + 2*0x1780bb420.marker{id: 108} + -0.5*0x1780951d0.marker{id: 113}
    objective{id: 1} == {objective 0x178034360: <250:1305> + <250:-1>*0x170093100.marker{id: 236} + <250:1>*0x170093330.marker{id: 267} + <250:-1>*0x170093560.marker{id: 244} + <250:1>*0x170096620.marker{id: 270} + <250:-1>*0x170096d50.marker{id: 240} + <250:-1>*0x170096da0.marker{id: 242} + <750:1, 250:-2>*0x1780ba700.negError{id: 297} + <250:3>*0x1780ba700.posErrorMarker{id: 296} + <750:1>*0x1780baac0.negError{id: 299} + <250:1>*0x1780baac0.posErrorMarker{id: 298} + <750:1, 250:1>*0x1780bad60.negError{id: 288} + <750:1, 250:1>*0x1780bae80.negError{id: 293} + <750:1>*0x1780baee0.negError{id: 290} + <250:1>*0x1780baee0.posErrorMarker{id: 289} + <750:1>*0x1780bb300.negError{id: 295} + <250:1>*0x1780bb300.posErrorMarker{id: 294} + <250:-1.19209e-07>*0x1780bba20.negError{id: 403}}

Constraints:
    <NSAutoresizingMaskLayoutConstraint:0x178094460 h=-&- v=-&- UIViewControllerWrapperView:0x178170140.midX == UINavigationTransitionView:0x1701e1c00.midX>        Marker:0x178094460.marker{id: 76} (Integralization adjustment:-1.25)
    <NSAutoresizingMaskLayoutConstraint:0x1780944b0 h=-&- v=-&- UIViewControllerWrapperView:0x178170140.width == UINavigationTransitionView:0x1701e1c00.width>      Marker:0x1780944b0.marker{id: 80} (Integralization adjustment:-2.5)
    <NSAutoresizingMaskLayoutConstraint:0x178094500 h=-&- v=-&- UIViewControllerWrapperView:0x178170140.midY == UINavigationTransitionView:0x1701e1c00.midY>        Marker:0x178094500.marker{id: 83}
    <NSAutoresizingMaskLayoutConstraint:0x178094550 h=-&- v=-&- UIViewControllerWrapperView:0x178170140.height == UINavigationTransitionView:0x1701e1c00.height>        Marker:0x178094550.marker{id: 85}
    <NSAutoresizingMaskLayoutConstraint:0x1780948c0 h=-&- v=-&- UINavigationTransitionView:0x1701e1c00.midX == UILayoutContainerView:0x1701a79a0.midX>      Marker:0x1780948c0.marker{id: 86} (Integralization adjustment:-1)
    <NSAutoresizingMaskLayoutConstraint:0x178094910 h=-&- v=-&- UINavigationTransitionView:0x1701e1c00.width == UILayoutContainerView:0x1701a79a0.width>        Marker:0x178094910.marker{id: 90} (Integralization adjustment:-2)
    <NSAutoresizingMaskLayoutConstraint:0x178094960 h=-&- v=-&- UINavigationTransitionView:0x1701e1c00.midY == UILayoutContainerView:0x1701a79a0.midY>      Marker:0x178094960.marker{id: 93}
    <NSAutoresizingMaskLayoutConstraint:0x1780949b0 h=-&- v=-&- UINavigationTransitionView:0x1701e1c00.height == UILayoutContainerView:0x1701a79a0.height>      Marker:0x1780949b0.marker{id: 95}
    <NSAutoresizingMaskLayoutConstraint:0x178094d20 h=-&- v=-&- UILayoutContainerView:0x1701a79a0.midX == UIWindow:0x15c50b0e0.midX>        Marker:0x178094d20.marker{id: 96} (Integralization adjustment:1.75001)
    <NSAutoresizingMaskLayoutConstraint:0x178094d70 h=-&- v=-&- UILayoutContainerView:0x1701a79a0.width == UIWindow:0x15c50b0e0.width>      Marker:0x178094d70.marker{id: 100} (Integralization adjustment:3.50001)
    <NSAutoresizingMaskLayoutConstraint:0x178094dc0 h=-&- v=-&- UILayoutContainerView:0x1701a79a0.midY == UIWindow:0x15c50b0e0.midY>        Marker:0x178094dc0.marker{id: 103}
    <NSAutoresizingMaskLayoutConstraint:0x178094e10 h=-&- v=-&- UILayoutContainerView:0x1701a79a0.height == UIWindow:0x15c50b0e0.height>        Marker:0x178094e10.marker{id: 105}
    <NSAutoresizingMaskLayoutConstraint:0x178095180 h=--- v=--- H:[UIWindow:0x15c50b0e0(768)]>      Marker:0x178095180.marker{id: 110}
    <NSAutoresizingMaskLayoutConstraint:0x1780951d0 h=--- v=--- V:[UIWindow:0x15c50b0e0(1024)]>     Marker:0x1780951d0.marker{id: 113}
    <NSContentSizeLayoutConstraint:0x1780ba700 H:[UILabel:0x15c617f50(390)] Hug:250 CompressionResistance:750>      Marker:0x1780ba700.posErrorMarker{id: 296}
    <NSContentSizeLayoutConstraint:0x1780baac0 V:[UILabel:0x15c617f50(21)] Hug:250 CompressionResistance:750>       Marker:0x1780baac0.posErrorMarker{id: 298}
    <NSContentSizeLayoutConstraint:0x1780bad60 H:[UILabel:0x15c603eb0(49)] Hug:250 CompressionResistance:750>       Marker:0x1780bad60.posErrorMarker{id: 287}
    <NSContentSizeLayoutConstraint:0x1780bae80 H:[UIButton:0x15c618a20(30)] Hug:250 CompressionResistance:750>      Marker:0x1780bae80.posErrorMarker{id: 292}
    <NSContentSizeLayoutConstraint:0x1780baee0 V:[UILabel:0x15c603eb0(21)] Hug:250 CompressionResistance:750>       Marker:0x1780baee0.posErrorMarker{id: 289}
    <NSContentSizeLayoutConstraint:0x1780bb300 V:[UIButton:0x15c618a20(30)] Hug:250 CompressionResistance:750>      Marker:0x1780bb300.posErrorMarker{id: 294}
    <NSLayoutConstraint:0x170093060 V:[UIView:0x170171340(48)]>     Marker:0x170093060.marker{id: 238}
    <NSLayoutConstraint:0x170093100 H:[UIView:0x170171340(48)]>     Marker:0x170093100.marker{id: 236}
    <NSLayoutConstraint:0x170093330 UIView:0x170171640.width == UILabel:0x15c617f50.width>      Marker:0x170093330.marker{id: 267} (Integralization adjustment:-1)
    <NSLayoutConstraint:0x170093560 H:[UILabel:0x15c603eb0]-(0)-|   (Names: '|':UIView:0x170171640 )>       Marker:0x170093560.marker{id: 244}
    <NSLayoutConstraint:0x170093600 UILabel:0x15c617f50.centerX == UIButton:0x15c618a20.centerX>        Marker:0x170093600.marker{id: 263}
    <NSLayoutConstraint:0x170093740 UILabel:0x15c617f50.centerX == UIView:0x170170bc0.centerX>      Marker:0x170093740.marker{id: 253}
    <NSLayoutConstraint:0x1700937e0 UIView:0x170171640.centerX == UILabel:0x15c617f50.centerX>      Marker:0x1700937e0.marker{id: 261} (Integralization adjustment:-0.5)
    <NSLayoutConstraint:0x170093d30 UILabel:0x15c617f50.width == 0.8*UIView:0x170170bc0.width>      Marker:0x170093d30.marker{id: 255} (Integralization adjustment:-0.4)
    <NSLayoutConstraint:0x170093dd0 V:[UIView:0x170171640]-(0)-[UILabel:0x15c617f50]>       Marker:0x170093dd0.marker{id: 256}
    <NSLayoutConstraint:0x170093f10 V:[UILabel:0x15c617f50]-(0)-[UIButton:0x15c618a20]>     Marker:0x170093f10.marker{id: 259}
    <NSLayoutConstraint:0x170093fb0 UILabel:0x15c617f50.centerY == UIView:0x170170bc0.centerY>      Marker:0x170093fb0.marker{id: 247}
    <NSLayoutConstraint:0x170096620 UIButton:0x15c618a20.width == UILabel:0x15c617f50.width>        Marker:0x170096620.marker{id: 270}
    <NSLayoutConstraint:0x170096d50 H:|-(0)-[UIView:0x170171340]   (Names: '|':UIView:0x170171640 )>        Marker:0x170096d50.marker{id: 240}
    <NSLayoutConstraint:0x170096da0 H:[UIView:0x170171340]-(0)-[UILabel:0x15c603eb0]>       Marker:0x170096da0.marker{id: 242}
    <_UIWindowAnchoringConstraint:0x1780bb3c0 h=--- v=--- UIWindow:0x15c50b0e0.midX == + 384>       Marker:0x1780bb3c0.marker{id: 106}
    <_UIWindowAnchoringConstraint:0x1780bb420 h=--- v=--- UIWindow:0x15c50b0e0.midY == + 512>       Marker:0x1780bb420.marker{id: 108}

Integralization Adjustments:
0x170093330.marker{id: 267} [<NSLayoutConstraint:0x170093330 UIView:0x170171640.width == UILabel:0x15c617f50.width>] -> -1.000000
0x1700937e0.marker{id: 261} [<NSLayoutConstraint:0x1700937e0 UIView:0x170171640.centerX == UILabel:0x15c617f50.centerX>] -> -0.500000
0x170093d30.marker{id: 255} [<NSLayoutConstraint:0x170093d30 UILabel:0x15c617f50.width == 0.8*UIView:0x170170bc0.width>] -> -0.400000
0x178094460.marker{id: 76} [<NSAutoresizingMaskLayoutConstraint:0x178094460 h=-&- v=-&- UIViewControllerWrapperView:0x178170140.midX == UINavigationTransitionView:0x1701e1c00.midX>] -> -1.250000
0x1780944b0.marker{id: 80} [<NSAutoresizingMaskLayoutConstraint:0x1780944b0 h=-&- v=-&- UIViewControllerWrapperView:0x178170140.width == UINavigationTransitionView:0x1701e1c00.width>] -> -2.500000
0x1780948c0.marker{id: 86} [<NSAutoresizingMaskLayoutConstraint:0x1780948c0 h=-&- v=-&- UINavigationTransitionView:0x1701e1c00.midX == UILayoutContainerView:0x1701a79a0.midX>] -> -1.000000
0x178094910.marker{id: 90} [<NSAutoresizingMaskLayoutConstraint:0x178094910 h=-&- v=-&- UINavigationTransitionView:0x1701e1c00.width == UILayoutContainerView:0x1701a79a0.width>] -> -2.000000
0x178094d20.marker{id: 96} [<NSAutoresizingMaskLayoutConstraint:0x178094d20 h=-&- v=-&- UILayoutContainerView:0x1701a79a0.midX == UIWindow:0x15c50b0e0.midX>] -> 1.750005
0x178094d70.marker{id: 100} [<NSAutoresizingMaskLayoutConstraint:0x178094d70 h=-&- v=-&- UILayoutContainerView:0x1701a79a0.width == UIWindow:0x15c50b0e0.width>] -> 3.500011

Statistics:
    36 rows. Variable counts:
        1 ->   5
        2 ->  14
        3 ->   6
        4 ->   5
        5 ->   1
        6 ->   3
        7 ->   1
        8 ->   1
}: internal error.  Cannot find an outgoing row head for incoming head 0x1780bba20.negError{id: 403}, which should never happen.'
*** First throw call stack:
(0x1816cf100 0x18df881fc 0x1816cf040 0x1821b86a8 0x1821b81ac 0x1821b384c 0x184691cdc 0x1849633b4 0x184690840 0x1847695a4 0x184846f40 0x1847c2af4 0x18493c794 0x1846d06fc 0x1846d0284 0x1846d0180 0x18428b888 0x18e55ffd4 0x18e5631dc 0x18168eddc 0x18168d11c 0x1815cddd0 0x18725dc0c 0x1846fefc4 0x1000f8550 0x1000f8590 0x18e57baa0)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

0 个答案:

没有答案