【问题标题】:"Unable to simultaneously satisfy constraints" with Personal Hotspot blue bar个人热点蓝条“无法同时满足约束”
【发布时间】:2016-05-19 01:50:34
【问题描述】:

在我运行我的应用并启用个人热点时收到以下警告,因此屏幕顶部的个人热点蓝条。有没有办法解决这个问题?

2016-05-19 09:07:55.589 RemindersPro[591:121237] 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. 
(
    "<NSLayoutConstraint:0x145d7ff30 V:|-(20)-[UIInputSetContainerView:0x145e77b70]   (Names: '|':UITextEffectsWindow:0x145d7e8d0 )>",
    "<NSLayoutConstraint:0x145d307a0 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x145e77b70]   (Names: '|':UITextEffectsWindow:0x145d7e8d0 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x145d7ff30 V:|-(20)-[UIInputSetContainerView:0x145e77b70]   (Names: '|':UITextEffectsWindow:0x145d7e8d0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
updating
reminderListsStructure of 24 calendars recreated.

我尝试按照In Call Status Bar (Unable to Satisfy Constraints) 中的建议修复它,方法是将以下函数添加到我的 AppDelegate。不幸的是,它没有帮助。

func application(application: UIApplication, willChangeStatusBarFrame newStatusBarFrame: CGRect) {
    for window in UIApplication.sharedApplication().windows {
        if window.dynamicType.self.description().containsString("UITextEffectsWindow") {
            window.removeConstraints(window.constraints)
        }
    }
}

【问题讨论】:

    标签: ios xcode swift interface-builder nslayoutconstraint


    【解决方案1】:

    该错误意味着您添加到个人热点栏的 2 个约束相互冲突,这意味着它们告诉酒吧进入两个不同的位置。由于这是不可能的,您会看到该错误。为了修复它,您必须查看已添加到条形图的约束,看看它们中的两个是否会将条形图放在不同的位置。 Xcode 实际上为您提供了这两个冲突的约束,并在错误中显示它们。

    要摆脱所有限制,试试这个:

    func application(application: UIApplication, willChangeStatusBarFrame newStatusBarFrame: CGRect) {
        for window in UIApplication.sharedApplication().windows {
            window.removeConstraints(window.constraints)
        }
    }
    

    【讨论】:

    • 我对根视图控制器没有任何限制。而且我没有以编程方式设置任何内容。我怎样才能找出造成这种情况的原因以及这些限制在哪里?
    • @Daniel 尝试更改 App Delegate 中的代码以移除所有窗口的约束
    • 我该怎么做?
    • 没用。仍然得到同样的错误。我在函数的开头放了一条打印语句,这样我就可以看到它确实被调用了,但它并没有修复错误......
    猜你喜欢
    • 1970-01-01
    • 2012-12-28
    • 1970-01-01
    • 2014-10-27
    • 2014-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多