我的应用程序相当大(大约20个屏幕),有些是大型UIVIEwControllers,其中包含多个子视图控制器.一些是具有自定义单元格的UItableVIEws和具有自定义单元格的UICollectionVIEws.我有一段时间来解决这个错误的原因(在横向旋转时发生)
以下是我的控制台中的信息:
2013-05-02 11:18:53.225 Smile[7519:c07] 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:0x16083b60 h=-&- v=-&- UIVIEw:0xa5a1d00.wIDth == UIWindow:0xa09eee0.wIDth>","<NSLayoutConstraint:0xa5a2180 V:[UIVIEw:0xa59f160]-(954)-| (names: '|':UIVIEw:0xa5a1d00 )>","<NSLayoutConstraint:0xa5a2140 V:|-(0)-[UIVIEw:0xa59f160] (names: '|':UIVIEw:0xa5a1d00 )>","<NSautoresizingMaskLayoutConstraint:0xa593340 h=--- v=--- H:[UIWindow:0xa09eee0(768)]>")Will attempt to recover by breaking constraint <NSLayoutConstraint:0xa5a2180 V:[UIVIEw:0xa59f160]-(954)-| (names: '|':UIVIEw:0xa5a1d00 )>Break on objc_exception_throw to catch this in the deBUGger.The methods in the UIConstraintBasedLayoutDeBUGging category on UIVIEw Listed in <UIKit/UIVIEw.h> may also be helpful.
如您所见,列出了内存地址.将这些内容粘贴到观察窗口的搜索栏中并没有太多显示.通过线程和队列调用堆栈进行筛选,我只在此断点上获得反汇编代码(异常断点).
解决方法 由于这些网站: Debugging iOS AutoLayout Issues和 Dancing with the Debugger,我找到了一种解决方案.感谢Xcode控制台,您可以确定问题来自哪个视图.解决方案:
>第1步:
>打开断点导航器(cmd 7)
>单击左下方的“添加”按钮
>选择“添加符号断点”
> UIVIEwAlertForUnsatisfiableConstraints中的’符号’类型
>第2步:运行您的项目.当控制台打印将尝试通过违反约束< NSLayoutConstraint:0x7fc82d3e18a0 H:[UIVIEw:0x7fc82aba1210(768)]>进行恢复时,复制视图的内存地址(此处为0x7fc82aba1210).>步骤3:在控制台中使用此命令更改此视图的背景以了解它是哪一个:e(voID)[0x7fc82d3e18a0 setBackgroundcolor:[UIcolor redcolor]]>步骤4:继续该程序并查看更新的UI.红色背景颜色的视图是有问题的视图.>步骤5:返回到您的IB并查找此视图中存在问题的约束.
总结以上是内存溢出为你收集整理的iphone – 将不可满足的NSLayoutConstraints的内存地址映射到UI控件全部内容,希望文章能够帮你解决iphone – 将不可满足的NSLayoutConstraints的内存地址映射到UI控件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)