2015-07-20 36 views
0

雖然我的故事板中沒有任何東西,但我在日誌中收到了一堆自動佈局約束錯誤。我無法理解他們大多尤其是定位具體的看法,他認爲是引發錯誤的文本字段:定位日誌中的自動佈局約束錯誤

2015-07-19 20:39:28.625 Daily[42447:417537] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<NSLayoutConstraint:0x7fd8a3e309e0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fd8a3dc4ea0(375)]>", 
"<NSLayoutConstraint:0x7fd8a3dcc3f0 UIView:0x7fd8a3f416c0.leading == UIView:0x7fd8a3dc4ea0.leadingMargin>", 
"<NSLayoutConstraint:0x7fd8a3dcc4e0 UIView:0x7fd8a3dc4ea0.centerX == UIView:0x7fd8a3f416c0.centerX>", 
"<NSLayoutConstraint:0x7fd8a3dcc670 V:[UIView:0x7fd8a3f416c0(81)]>", 
"<NSLayoutConstraint:0x7fd8a3dcc6c0 UIView:0x7fd8a3f416c0.width == 4.54321*UIView:0x7fd8a3f416c0.height>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fd8a3dcc6c0 UIView:0x7fd8a3f416c0.width == 4.54321*UIView:0x7fd8a3f416c0.height> 
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. 

2015-07-19 20:39:28.627 Daily[42447:417537] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<NSLayoutConstraint:0x7fd8a3e309e0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fd8a3dc4ea0(375)]>", 
"<NSLayoutConstraint:0x7fd8a3dcbf20 V:[UIView:0x7fd8a3dc4a50]-(76)-[UIView:0x7fd8a3dcb8b0]>", 
"<NSLayoutConstraint:0x7fd8a3dcbfc0 V:[_UILayoutGuide:0x7fd8a3dc4fb0]-(322)-[UIView:0x7fd8a3dcb8b0]>", 
"<NSLayoutConstraint:0x7fd8a3dcc010 UIView:0x7fd8a3dc4ea0.width == 3.25203*UIView:0x7fd8a3dc4a50.height>", 
"<NSLayoutConstraint:0x7fd8a3dcc100 V:[UIView:0x7fd8a3dcc150]-(34)-[UIView:0x7fd8a3dc4a50]>", 
"<NSLayoutConstraint:0x7fd8a3dcc5d0 V:[_UILayoutGuide:0x7fd8a3dc4fb0]-(31)-[UIView:0x7fd8a3dcc150]>", 
"<NSLayoutConstraint:0x7fd8a3dcdec0 H:[UIView:0x7fd8a3dcc150(368)]>", 
"<NSLayoutConstraint:0x7fd8a3dcdf10 UIView:0x7fd8a3dcc150.width == 6.34483*UIView:0x7fd8a3dcc150.height>" 
) 

Will attempt to recover by breaking constraint 

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. 
2015-07-19 20:39:28.628 Daily[42447:417537] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<NSLayoutConstraint:0x7fd8a3e309e0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fd8a3dc4ea0(375)]>", 
"<NSLayoutConstraint:0x7fd8a3dcbed0 UIView:0x7fd8a3dcb8b0.trailing == UIView:0x7fd8a3dc4ea0.trailingMargin>", 
"<NSLayoutConstraint:0x7fd8a3dcbf70 UIView:0x7fd8a3dcb8b0.leading == UIView:0x7fd8a3dc4ea0.leadingMargin>", 
"<NSLayoutConstraint:0x7fd8a3dccf80 H:[UIView:0x7fd8a3dcb8b0(368)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fd8a3dccf80 H:[UIView:0x7fd8a3dcb8b0(368)]> 

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. 
2015-07-19 20:39:28.644 Daily[42447:417537] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<NSLayoutConstraint:0x7fd8a3e309e0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fd8a3dc4ea0(375)]>", 
"<NSLayoutConstraint:0x7fd8a3dcc3f0 UIView:0x7fd8a3f416c0.leading == UIView:0x7fd8a3dc4ea0.leadingMargin>", 
"<NSLayoutConstraint:0x7fd8a3dcc4e0 UIView:0x7fd8a3dc4ea0.centerX == UIView:0x7fd8a3f416c0.centerX>", 
"<NSLayoutConstraint:0x7fd8a3dcc620 H:[UIView:0x7fd8a3f416c0(368)]>" 
) 

Will attempt to recover by breaking constraint 

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. 
+0

你在故事板中使用大小類?如果你換成一些更專業的尺寸,你有沒有檢查過什麼?你在移動/調整任何代碼? – Fonix

回答

2

你加入錯誤的約束的意見。如果添加centerX約束,那麼它們不需要添加前導空間約束,它將衝突約束。將約束條件添加爲centerX,height,width,&可以根據需要給出Y位置。

1

您的方法是可觀的。但是,大多數情況下,我想通過禁用自動佈局和類來開發應用程序。您需要在界面構建器中設置調整邊距。如果你不清楚我的解決方案,請讓我知道,我會解釋清楚:) :)

+0

是的,我沒有真正關注,我對iOS開發很新。我從Swift和Auto Layout開始,但是我意識到Auto Layout並不像看起來那麼容易。我問了一些其他人,他們中的一些人告訴我,我不能只動畫UIViews,我需要改變約束來實現視圖的動畫。其中一些人告訴我放棄所有的汽車佈局。所以我現在有點衝突。 – Liumx31

+0

另外,如果你看看我以前的[問題](stackoverflow)上的(http://stackoverflow.com/questions/31506480/uiview-disappears-when-keyboard-pops-up-for-uitextfield?noredirect=1#comment50975954_31506480),你可以看到我遇到的問題。我幾乎可以肯定,鍵盤和UIView動畫的這個問題是由Auto Layout約束中的上述錯誤引起的。 – Liumx31

+0

哦,那麼您可以通過單擊三角形圖標,在故事板底部添加建議的約束條件。但是,我寧願建議使用禁用方法,我沒有面臨任何問題,我的應用程序可以在任何設備上以精確對齊的方式運行:) –