我明白,XCode將捕獲不可批准的NSLayoutConstraints
並給你一些關於它的信息,但我不知道如何獲取控件/約束的內存地址並將其映射到有問題的實際控制。將令人難以置信的NSLayoutConstraints的內存地址映射到UI控件
我的應用程序是相當大(約20屏),有些是大UIViewControllers與內他們幾個子視圖控制器。一些是帶有自定義單元的UITableViews和帶有自定義單元的UICollectionViews。我在的時候套結下來這個錯誤的原因(這發生在橫向旋轉)
這裏地獄從我的控制檯的信息:
2013-05-02 11:18:53.225 Smile[7519:c07] 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:0x16083b60 h=-&- v=-&- UIView:0xa5a1d00.width == UIWindow:0xa09eee0.width>",
"<NSLayoutConstraint:0xa5a2180 V:[UIView:0xa59f160]-(954)-| (Names: '|':UIView:0xa5a1d00)>",
"<NSLayoutConstraint:0xa5a2140 V:|-(0)-[UIView:0xa59f160] (Names: '|':UIView:0xa5a1d00)>",
"<NSAutoresizingMaskLayoutConstraint:0xa593340 h=--- v=--- H:[UIWindow:0xa09eee0(768)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0xa5a2180 V:[UIView:0xa59f160]-(954)-| (Names: '|':UIView:0xa5a1d00)>
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.
正如你所看到的,有記憶列出的地址。將這些內容粘貼到觀察窗口的搜索欄中並不會顯示太多內容。同時篩選線程和隊列調用堆棧,我只能得到這個斷點上的反彙編代碼(異常斷點)。
visualizeConstraints只適用於OS X – 2013-05-02 19:34:35
哎呀!出於某種原因,我認爲UILayoutConstraint是一件事情,因此我認爲這是在Mac上。我想我沒有仔細閱讀這個問題! – 2013-05-02 19:50:30