【发布时间】:2016-02-27 10:46:54
【问题描述】:
Xcode 7.1.1、7.2 在应用程序(电话)中使用 openURL 时注意到。 为我关于这个 VC 的所有约束添加了 ID,并且没有一个显示为带有警告的约束。
func makeCall(theNumber: String) {
if theNumber != "" {
if let url = NSURL(string: "tel://" + theNumber) {
UIApplication.sharedApplication().openURL(url)
}
}
}
调试区显示:
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.
(
"<NSLayoutConstraint:0x15ea3670 V:|-(20)-[UIInputSetContainerView:0x15e87f90] (Names: '|':UITextEffectsWindow:0x15df11f0 )>",
"<NSLayoutConstraint:0x15d986a0 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x15e87f90] (Names: '|':UITextEffectsWindow:0x15df11f0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x15ea3670 V:|-(20)-[UIInputSetContainerView:0x15e87f90] (Names: '|':UITextEffectsWindow:0x15df11f0 )>
【问题讨论】:
-
它不是苹果的错误。它明确表示,在这两个约束中,不需要一个,并且在运行时会发生冲突。我确定您需要从这两个约束中删除任何一个约束,但要确定要删除哪个约束以及需要添加哪些更多约束而不是使故事板中的屏幕自动布局警告免费我需要查看您设计的元素和约束。您可以发布一些屏幕截图或解释该部分中所有元素使用的约束吗?
-
在试图解决这个问题时,我在这个 VC 中的每个约束中添加了一个 id - 有些是故事板,有些是编程的。我已经测试了它们是否在故意添加冲突值时出现。如您所见,问题约束没有显示任何添加的 id。我不确定这些问题约束是在哪里创建的。没有自定义键盘等。为了澄清,仅当使用按钮调用 makeCall() 并且手机应用程序打开时才会出现警告。
-
@MaheshAgrawal 这一定是苹果虫。我对视图没有任何限制,我没有情节提要,甚至没有 nib 文件,我仍然收到此错误消息。
标签: ios autolayout constraints xcode7