相关疑难解决方法(0)

无法同时满足约束,将尝试通过违反约束来恢复

以下是我在调试区域收到的错误消息.它运行正常,没有任何错误,除了我收到此错误.这会阻止苹果接受应用吗?我如何解决它?

2012-07-26 01:58:18.621 Rolo[33597:11303] 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) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x887d630 h=--& v=--& V:[UIButtonLabel:0x886ed80(19)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x887d5f0 h=--& …
Run Code Online (Sandbox Code Playgroud)

debugging objective-c ios nslayoutconstraint

140
推荐指数
8
解决办法
13万
查看次数

什么是'UIView-Encapsulated-Layout-Width'约束?

我一直得到'无法同时满足约束'的例外(Xcode 5,iOS 7,设备和模拟器),其中列表中的一个约束是这样的:

"<NSLayoutConstraint:0x165b23d0 'UIView-Encapsulated-Layout-Width'
H:[StoryPlayerCell:0x165affc0(0)]>"
Run Code Online (Sandbox Code Playgroud)

我自己没有设置这个约束.它也不是NSAutoresizingMaskLayoutConstraint.但是它来自哪里?我怎么能摆脱它呢?

我不知道.我'UIView-Encapsulated-Layout-Width'在Apple的文档中找不到任何相关内容.即便是谷歌搜索也没有任何回报.

有什么建议?

PS:我在UICollectionView一个自定义子类中使用这个单元格UICollectionViewFlowLayout.也许这'Encapsulated-Layout'部分与此有关?

ios autolayout uicollectionview nslayoutconstraint uicollectionviewlayout

48
推荐指数
2
解决办法
1万
查看次数

嵌套的UIStack查看破坏的约束

我有一个复杂的视图层次结构,内置在Interface Builder中,具有嵌套的UIStackViews.每次隐藏一些内部堆栈视图时,我都会收到"不满意的约束"通知.我跟踪到了这个:

(
    "<NSLayoutConstraint:0x1396632d0 'UISV-canvas-connection' UIStackView:0x1392c5020.top == UILabel:0x13960cd30'Also available on iBooks'.top>",
    "<NSLayoutConstraint:0x139663470 'UISV-canvas-connection' V:[UIButton:0x139554f80]-(0)-|   (Names: '|':UIStackView:0x1392c5020 )>",
    "<NSLayoutConstraint:0x139552350 'UISV-hiding' V:[UIStackView:0x1392c5020(0)]>",
    "<NSLayoutConstraint:0x139663890 'UISV-spacing' V:[UILabel:0x13960cd30'Also available on iBooks']-(8)-[UIButton:0x139554f80]>"
)
Run Code Online (Sandbox Code Playgroud)

具体来说,UISV-spacing约束:当隐藏UIStackView时,它的高约束得到一个0常量,但这似乎与内部stackview的间距约束发生冲突:它需要我的Label和Button之间有8个点,这与隐藏约束是不可调和的,因此约束崩溃.

有没有解决的办法?我已经尝试递归隐藏隐藏堆栈视图的所有内部StackViews,但这导致奇怪的动画,其中内容浮出屏幕,并导致严重的FPS下降启动,同时仍然没有解决问题.

cocoa-touch interface-builder ios autolayout uistackview

27
推荐指数
4
解决办法
1万
查看次数

如何找到崩溃约束?

有时我会不断收到这样的错误 - 没有任何暗示TextView或Button的含义:

    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:0x11d748d0 V:[UITextView:0xc1bb000(65)]>",
    "<NSLayoutConstraint:0x11d77620 V:[UIButton:0x11d71cf0(44)]>",
    "<NSLayoutConstraint:0x11d7be30 V:[UIButton:0x11d79e70(43)]>",
    "<NSLayoutConstraint:0xa1980d0 …
Run Code Online (Sandbox Code Playgroud)

xcode constraints

5
推荐指数
1
解决办法
2297
查看次数