18

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

Sti
  • 8,275
  • 9
  • 62
  • 124
  • My tip: When there's a constraint issue in Xcode 9, the debugger shows a little exclamation point in the View Navigator. Maybe that's enough for your need? – Mick F Oct 30 '17 at 15:02
  • @DirtyHenry Sometimes, sure, but not always. The warnings I get right now only happen at runtime. Also, some of my constraints are created programmatically, so they don't show warning. – Sti Oct 30 '17 at 15:10

1 Answers1

35

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

DonMag
  • 69,424
  • 5
  • 50
  • 86
  • 1
    or simply right click on that view & select "reveal in debug navigator" – Ahmadreza Aug 08 '21 at 17:08
  • 3
    @Ahmadreza - I believe you misunderstood the question. If, for example, auto-layout encounters a problem and prints to the debug console `UIView:0x7fe38456eeb0`, how to find **that view**? The question is **not**: *"how to find the **selected view** in the in the hierarchy"* – DonMag Aug 09 '21 at 12:16