Sti
Sti

Reputation: 8503

How to find views in Debug View Hierarchy based on their address?

We all get them sometimes..

** [LayoutConstraints] 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:0x608000287670 H:|-(16)-[UIView:0x7fe38456eeb0](LTR)   (active, names: '|':MyApp.MyCell:0x7fe3848d9400'MyCellIdentifier' )>",
    "<NSLayoutConstraint:0x6080002876c0 UIView:0x7fe38456eeb0.right == MyApp.MyCell:0x7fe3848d9400'MyCellIdentifier'.right   (active)>",
    "<NSLayoutConstraint:0x608000288520 'UIView-Encapsulated-Layout-Width' MyApp.MyCell:0x7fe3848d9400'MyCellIdentifier'.width == 0   (active)>"
)

You don't have to read into what it means, it doesn't really have anything to do with this question. This started showing up in my log after I did some major changes to my app. I have googled it, and I understand that this particular issue is a weird one where I have to find a certain constraint, and set its priority to 999, so that the system can set the cell's width to 0 if it wants to. This is fine.

My question is not directly directed towards this particular issue. Whenever I get something like this in the log, there's always an address following the class name. Like the one shown in the example above: MyApp.MyCell:0x7fe3848d9400.

Can I use this address and search the view hierarchy to find the view? I know that if I click Debug View Hierarchy I get a sweet "stasis" view of my app. The problem is that my app is getting pretty big, and I have a lot of views. Especially in UITableView's. There are so many views present, each with their own address.

If I select any view in the debug hierarchy, I can easily see its address, as seen in the top right corner in the image below.

Since I already have the address of the view I want to find, is there a way to locate it? The way I'm doing it now, is to go through all the relevant views on my debug-screen, copy their address, and CMD+F CMD+V into my output log to see if that particular view was mentioned in my log output.

Grid view

There has to be a better way..

Upvotes: 20

Views: 6198

Answers (1)

DonMag
DonMag

Reputation: 77682

If you type (or copy/paste) the hex address into the search field at the bottom of the Navigator Pane, it should filter / find the object:

enter image description here

Upvotes: 38

Related Questions