ios - -[NSLayoutConstraint 常量] 断言失败

标签 ios xcode storyboard autolayout

在我的 iPhone 上运行我的应用程序后出现以下错误:

Assertion failure in -[NSLayoutConstraint constant],  /SourceCache/Foundation/Foundation /Layout.subproj/NSLayoutConstraint.m:6432015-10-26 08:43:06.080 AuberML[195:6172] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '(null)'

该项目是在另一台计算机上完成的,它运行得非常棒。 如果我从 View 中删除所有约束(在 IB 中),应用程序不会崩溃,但元素会错位。

我使用 iPhone 6 开发了该应用程序,现在尝试在 iPhone 5 上运行它。

我想我必须同时重做所有的约束......

最佳答案

问题是 IB 将常量设置为“标准”:

IB constraint settings

在 iOS >= 9.0.1 下,它工作正常。对于 iOS < 9,它需要明确设置为 0。

IB constraint settings

我还没有尝试过 Xcode 7.1。

希望对您有所帮助!

这显然与 Main.storyboard 约束定义中的以下 symbolic="YES" 语句有关:

<constraint firstItem="inT-RM-poI" firstAttribute="top" secondItem="c5b-4a-YMr" secondAttribute="bottom" multiplier="1175:1920" symbolic="YES" id="jgh-yf-mvT"/>

通过删除它,工作正常...

关于ios - -[NSLayoutConstraint 常量] 断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33343150/

相关文章:

iphone - 显示一个隐藏的 UITabBArController

ios:条件绑定(bind)的初始化程序必须具有可选类型,而不是 'LOTAnimationView'

ios - 快速使用 Spotify SDK 的编译器错误

xcode - Swift:通过代码更改 Storyboard上元素的位置

swift - 我在 XCode 上重构 Storyboard时丢失了一些工作?我能做些什么?

ios - 如何获取 collectionviewcell 的选定 indexpath.row 的数量作为 slideshare

android - 由于缺少 info.plist 和其他文件,Worklight 在 OS X、iPhone 和 Android 上的构建失败

iphone - IBAction按钮 “Unrecognized Selector Sent to Instance”错误

swift - 多个条目进入 tableView

ios - 为什么当我将一个 TableView 单元格连接到另一个具有模式转场的 View Controller 时,我在 View Controller 中进行了更改?