亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法同時滿足約束條件,將嘗試通過打破約束條件進行恢復

無法同時滿足約束條件,將嘗試通過打破約束條件進行恢復

慕妹3146593 2019-10-05 11:05:15
以下是我在調試區域中收到的錯誤消息。它運行正常,除了我收到此錯誤外,沒有什么錯。這會阻止蘋果接受該應用程序嗎?我如何解決它?2012-07-26 01:58:18.621 Rolo[33597:11303] 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) (    "<NSAutoresizingMaskLayoutConstraint:0x887d630 h=--& v=--& V:[UIButtonLabel:0x886ed80(19)]>",    "<NSAutoresizingMaskLayoutConstraint:0x887d5f0 h=--& v=--& UIButtonLabel:0x886ed80.midY == + 37.5>",    "<NSAutoresizingMaskLayoutConstraint:0x887b4b0 h=--& v=--& V:[UIButtonLabel:0x72bb9b0(19)]>",    "<NSAutoresizingMaskLayoutConstraint:0x887b470 h=--& v=--& UIButtonLabel:0x72bb9b0.midY == - 0.5>",    "<NSLayoutConstraint:0x72bf860 V:[UILabel:0x72bf7c0(17)]>",    "<NSLayoutConstraint:0x72c2430 UILabel:0x72bfad0.top == UILabel:0x72bf7c0.top>",    "<NSLayoutConstraint:0x72c2370 UILabel:0x72c0270.top == UILabel:0x72bfad0.top>",    "<NSLayoutConstraint:0x72c22b0 V:[UILabel:0x72bf7c0]-(NSSpace(8))-[UIButton:0x886efe0]>",    "<NSLayoutConstraint:0x72c15b0 V:[UILabel:0x72c0270]-(NSSpace(8))-[UIRoundedRectButton:0x72bbc10]>",    "<NSLayoutConstraint:0x72c1570 UIRoundedRectButton:0x72bbc10.baseline == UIRoundedRectButton:0x7571170.baseline>",    "<NSLayoutConstraint:0x72c21f0 UIRoundedRectButton:0x7571170.top == UIButton:0x886efe0.top>")Will attempt to recover by breaking constraint <NSLayoutConstraint:0x72bf860 V:[UILabel:0x72bf7c0(17)]>Break on objc_exception_throw to catch this in the debugger.The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
查看完整描述

3 回答

?
嚕嚕噠

TA貢獻1784條經驗 獲得超7個贊

我拋出了很多這樣的異常,我找到解決它們的最快,最簡單的方法是在異常中找到唯一的值,然后在情節提要源代碼中搜索這些異常。這幫助我找到了導致問題的實際視圖和約束(我在所有視圖上使用了有意義的userLabel,這使得跟蹤約束和視圖變得容易得多)...


因此,使用上述例外,我將在xcode(或其他編輯器)中以“源代碼”的形式打開情節提要,并尋找可以找到的東西...


<NSLayoutConstraint:0x72bf860 V:[UILabel:0x72bf7c0(17)]> 

..這看起來像UILabel上的垂直(V)約束,值為(17)。


查看例外情況,我也發現


<NSLayoutConstraint:0x72c22b0 V:[UILabel:0x72bf7c0]-(NSSpace(8))-[UIButton:0x886efe0]>

看起來UILabel(0x72bf7c0)接近于UIButton(0x886efe0),并具有一定的垂直間距(8)。


希望這足以讓我在情節提要源代碼中找到特定的視圖(可能是通過最初在文本中搜索“ 17”)或至少一些可能的候選者。從那里,我應該能夠真正找出這些故事在情節提要中的哪些視圖,這將使查找問題變得容易得多(查找“重復的”固定或固定與大小限制沖突的位置)。


查看完整回答
反對 回復 2019-10-05
?
qq_遁去的一_1

TA貢獻1725條經驗 獲得超8個贊

請注意,不要在同一方向和類型上使用多個約束。


例如: 尾隨的垂直約束= 15,而另一個約束> = 10。


有時,Xcode會創建一些您沒有注意到的約束。您必須擺脫冗余約束,日志警告肯定會消失。


http://img1.sycdn.imooc.com//5d9808e6000121c203300294.jpg

另外,您可以直接從日志中讀取和檢測某些特定原因:


NSLayoutConstraint:0xa338390 V:|-(15)-[UILabel:0xa331260](名稱:'|':UILabel:0xa330270)>


這可以理解為UILabel約束中的問題,它導致垂直約束長15pt。


NSLayoutConstraint:0x859ab20 H :-( 13)-| [UIView:0x85a8fb0] ...


這將是尾隨水平約束等。


查看完整回答
反對 回復 2019-10-05
  • 3 回答
  • 0 關注
  • 2162 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號