【问题标题】:Constraint conflict warning using openURL使用 openURL 的约束冲突警告
【发布时间】: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


【解决方案1】:

是的,创建了一个没有添加视图/约束(如所述)的空白单视图项目,使用命令 + y 切换模拟器,并收到相同的约束警告。

|-(20)-[UIInputSetContainerView constraint breaks when call-in status bar gets visible

【讨论】:

    猜你喜欢
    • 2013-02-16
    • 2011-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-05
    • 2011-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多