自动布局在Xcode 6调试器和崩溃的仪器中不起作用

时间:2015-07-23 05:59:13

标签: ios xcode autolayout instruments

我在Xcode 6.4中遇到了一个奇怪的问题。在某些屏幕上,自动布局报告我的约束无效,我的应用程序抛出异常并拒绝继续。几天前第一次遇到这个问题,我发现我可以使用Cocoa Layout分析器,当我连接了分析器时,问题突然消失了。但是,现在我在另一个地方再次遇到问题,并且由于Cocoa Layout中的stringValue问题,探查器无法启动。当Cocoa Layout工作时,它会崩溃我的Mac的Safari。

iOS和SIM卡以及7.1和8.4的设备都是相同的例外。

通常我会认为这是一个实际问题,我使用了自动布局,但我的团队的其他成员在他们的副本上运行相同的版本时没有看到同样的问题,这个屏幕的布局已经工作好几周(直到今天),并且在没有连接到调试器的情况下,布局在设备上工作得很好。

探测器崩溃的前几行:

Application Specific Information:
objc_msgSend() selector name: stringValue


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x00007fff8b26d0dd objc_msgSend + 29
1   com.apple.Foundation            0x00007fff85f838aa -[NSLayoutConstraint description] + 678
2   com.apple.Foundation            0x00007fff85d76f91 -[NSLayoutConstraint _removeFromEngine:] + 251
3   com.apple.AppKit                0x00007fff8295149f -[NSView(NSConstraintBasedLayout) _layoutEngine_willRemoveLayoutConstraint:] + 43
4   com.apple.AppKit                0x00007fff827ddfc9 -[NSView(NSConstraintBasedLayout) _constraints_willChangeAutoresizingConstraintsArrayForContainedView:] + 201
5   com.apple.AppKit                0x00007fff827d948e -[NSView(NSConstraintBasedLayout) _setAutoresizingConstraints:] + 277
6   com.apple.AppKit                0x00007fff827d9277 -[NSView(NSConstraintBasedLayout) _invalidateAutoresizingConstraints] + 49
7   com.apple.AppKit                0x00007fff827dc586 -[NSView _setSuperview:] + 1041

Xcode告诉我的是错误的:

2015-07-23 00:52:25.622 Hinted[42128:355616] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x7f8800d3ff10 V:[UILabel:0x7f8800d526a0'Jul 21, 2015'(15)]>",
    "<NSLayoutConstraint:0x7f8800d32140 V:[UILabel:0x7f8800d32d80'Randy S.'(15)]>",
    "<NSLayoutConstraint:0x7f8800d319c0 no_photo.width == no_photo.height   (Names: no_photo:0x7f8800d52eb0 )>",
    "<NSLayoutConstraint:0x7f8800d3fa30 anonymous.width == anonymous.height   (Names: anonymous:0x7f8800d53160 )>",
    "<NSLayoutConstraint:0x7f8800d27060 no_photo.top == UITableViewCellContentView:0x7f8800d2cfe0.topMargin   (Names: no_photo:0x7f8800d52eb0 )>",
    "<NSLayoutConstraint:0x7f8800d26f90 no_photo.leading == UITableViewCellContentView:0x7f8800d2cfe0.leadingMargin   (Names: no_photo:0x7f8800d52eb0 )>",
    "<NSLayoutConstraint:0x7f8800d26ce0 V:[no_photo]-(3)-[UILabel:0x7f8800d32d80'Randy S.']   (Names: no_photo:0x7f8800d52eb0 )>",
    "<NSLayoutConstraint:0x7f8800d26c40 UITableViewCellContentView:0x7f8800d2cfe0.bottomMargin == UILabel:0x7f8800d32d80'Randy S.'.bottom - 9>",
    "<NSLayoutConstraint:0x7f8800d17c10 H:[no_photo]-(8)-[UILabel:0x7f8800d260b0'Test reply']   (Names: no_photo:0x7f8800d52eb0 )>",
    "<NSLayoutConstraint:0x7f8800d0c790 V:[anonymous]-(25)-[UILabel:0x7f8800d526a0'Jul 21, 2015']   (Names: anonymous:0x7f8800d53160 )>",
    "<NSLayoutConstraint:0x7f8800d30120 V:[UILabel:0x7f8800d526a0'Jul 21, 2015']-(0)-|   (Names: '|':UITableViewCellContentView:0x7f8800d2cfe0 )>",
    "<NSLayoutConstraint:0x7f8800d2fff0 anonymous.trailing == UITableViewCellContentView:0x7f8800d2cfe0.trailingMargin   (Names: anonymous:0x7f8800d53160 )>",
    "<NSLayoutConstraint:0x7f8800d30040 H:[UILabel:0x7f8800d260b0'Test reply']-(8)-[anonymous]   (Names: anonymous:0x7f8800d53160 )>",
    "<NSLayoutConstraint:0x7f8800d2ff10 anonymous.top == UITableViewCellContentView:0x7f8800d2cfe0.topMargin   (Names: anonymous:0x7f8800d53160 )>",
    "<NSLayoutConstraint:0x7f88006e6bc0 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x7f8800d2cfe0(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f8800d32140 V:[UILabel:0x7f8800d32d80'Randy S.'(15)]>

Nuking Xcode生成的文件夹,干净的构建,干净的构建文件夹,重新安装Xcode,尝试Xcode 7测试版 - 所有没有变化......同样的问题。

0 个答案:

没有答案