iOS 10:NSInvalidLayoutConstraintException:约束不适当地关联了不兼容类型的锚点 [英] iOS 10: NSInvalidLayoutConstraintException: Constraint improperly relates anchors of incompatible types
问题描述
更新到iOS 10后,我的一个应用中出现了很多错误
After updating to iOS 10 Im getting this error a bunch on one of my apps
NSInvalidLayoutConstraintException:约束关系不正确不兼容类型的锚点:
NSInvalidLayoutConstraintException: Constraint improperly relates anchors of incompatible types:
<NSLayoutConstraint:0x170495270 UIView:0x1010e1d90.top == AppName.OtherView:0x1010dc6f0.centerX (active)>
我以前从来没有遇到过使用这样的约束的问题,我只能在我的iOS 10设备上使用它.有什么想法吗?
I've never had an issue using a constraint like this before and I'm only getting it on my iOS 10 devices. Any ideas?
推荐答案
您可能正在执行以下操作:
You perhaps are doing something like this:
NSLayoutConstraint(item: viewA, attribute:
.leading , relatedBy: .equal, toItem: parentView, attribute: .top, multiplier: 1.0, constant: 20)
因此,请勿将正确的锚点缝合在一起,例如 .leading
和 .top
.在这种情况下,它必须是 .leading
和.Leading
.
So you do not stitch the correct anchors together like .leading
and .top
. In this case it must be .leading
and .leading
.
有趣的是,这不是iOS9的问题.
Interestingly this wasn't a problem with iOS9.
这篇关于iOS 10:NSInvalidLayoutConstraintException:约束不适当地关联了不兼容类型的锚点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!