0
Xcode 7.1.1,7.2 在應用程序(電話呼叫)中使用openURL時注意到。 添加了對我關於這個VC的所有約束的id,沒有一個顯示爲帶有警告的約束。使用openURL約束衝突警告
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)>
它不是蘋果的bug。它清楚地表明,在這兩個約束中,不需要它,並且在運行時發生衝突。確定你需要從這兩個中刪除任何一個約束,但要確定要刪除的約束以及還需要添加更多的約束,而不是使故事板中的屏幕自動佈局警告免費,我需要查看您的設計元素和約束。你能發表一些截圖或解釋部分中所有元素的約束嗎? –
爲了追逐這個問題,我在這個VC的每個約束中都添加了一個id - 一些是storyboard,一些是編程的。我已經測試過是否有意添加衝突值時出現。如您所見,問題約束不會顯示任何添加的ID。我不確定這些問題約束是在哪裏創建的。沒有自定義鍵盤等。爲了說明,只有當使用按鈕調用makeCall()並打開手機應用程序時纔會發出警告。 – agent86
@MaheshAgrawal這必須是一個蘋果的錯誤。我對該視圖沒有任何約束,我沒有故事板或甚至是一個nib文件,我仍然收到此錯誤消息。 – turingtested