0

Hi I am working on app and in this I have a UITableView With custom cell design. When I go to this view controller I can see there is a bunch of issues stated there in design. So I thought to fix them. Just quickly jumping into the issue and here it is what I was looking at

        Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-02-21 11:35:00.835363+0500 HIRING App[490:51013] [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:0x2828bada0 UIButton:0x139cd30e0'Auto Add'.width == 100   (active)>",
    "<NSLayoutConstraint:0x2828bbd40 H:|-(0)-[UIButton:0x139cd30e0'Auto Add']   (active, names: '|':UIStackView:0x139bc3d50 )>",
    "<NSLayoutConstraint:0x2828bbd90 H:[UIButton:0x139cd30e0'Auto Add']-(4)-|   (active, names: '|':UIStackView:0x139bc3d50 )>",
    "<NSLayoutConstraint:0x282beb4d0 H:[UIStackView:0x139bc3d50]-(4)-|   (active, names: '|':UIView:0x139bc8970 )>",
    "<NSLayoutConstraint:0x282beb520 H:|-(4)-[UIStackView:0x139bc3d50]   (active, names: '|':UIView:0x139bc8970 )>",
    "<NSLayoutConstraint:0x2828a6620 UIView:0x139cd5ed0.width == 0.4*UIView:0x139bcf9f0.width   (active)>",
    "<NSLayoutConstraint:0x2828a6710 H:|-(0)-[UIView:0x139cd5ed0]   (active, names: '|':UIView:0x139bcf9f0 )>",
    "<NSLayoutConstraint:0x2828a6800 H:[UIView:0x139cd5ed0]-(1)-[UIView:0x139bc8970]   (active)>",
    "<NSLayoutConstraint:0x2828a75c0 H:[UIView:0x139bc8970]-(0)-|   (active, names: '|':UIView:0x139bcf9f0 )>",
    "<NSLayoutConstraint:0x2828aa3f0 UIView:0x139bcf9f0.width == 0.75*UIView:0x139cd2230.width   (active)>",
    "<NSLayoutConstraint:0x2828f2d50 H:|-(0)-[UIView:0x139cd2ab0]   (active, names: '|':UIView:0x139cd7ec0 )>",
    "<NSLayoutConstraint:0x2828fbd40 UIView:0x139cd2ab0.width == 0.32*UIView:0x139cd7ec0.width   (active)>",
    "<NSLayoutConstraint:0x282812ee0 H:[UIView:0x139cd2ab0]-(0)-[UIView:0x139cd2230]   (active)>",
    "<NSLayoutConstraint:0x282813890 H:[UIView:0x139cd2230]-(0)-|   (active, names: '|':UIView:0x139cd7ec0 )>",
    "<NSLayoutConstraint:0x282beb660 H:|-(0)-[UIView:0x139cd7ec0]   (active, names: '|':UIView:0x139ccca70 )>",
    "<NSLayoutConstraint:0x282beb750 UIView:0x139cd7ec0.trailing == UIButton:0x139cd4240.trailing   (active)>",
    "<NSLayoutConstraint:0x282beb7f0 H:[UIButton:0x139cd4240]-(4)-|   (active, names: '|':UIView:0x139ccca70 )>",
    "<NSLayoutConstraint:0x282beba20 H:|-(8)-[UIView:0x139ccca70]   (active, names: '|':UITableViewCellContentView:0x139cf34c0 )>",
    "<NSLayoutConstraint:0x282beba70 H:[UIView:0x139ccca70]-(8)-|   (active, names: '|':UITableViewCellContentView:0x139cf34c0 )>",
    "<NSLayoutConstraint:0x2828b9d60 'fittingSizeHTarget' UITableViewCellContentView:0x139cf34c0.width == 414   (active)>"
)

This is my first time of fixing UI view. I got great help on this SO thread. But I really did not get how did he solved the issue. I did same thing to print out details of my design issue so I got something very much clear but still I am not getting which thing to settle first. Please guide me through or share something that can help me in identifying issues. thanks in advance. Following is the trace that I got when applied Symbolic break point as suggested in SO link.

    UIWindow:0x137e36480
|   UILayoutContainerView:0x137d41200
|   |   UITransitionView:0x137d41710
|   |   |   UIViewControllerWrapperView:0x139baa680
|   |   |   |   UILayoutContainerView:0x137e36280
|   |   |   |   |   UINavigationTransitionView:0x137e58cd0
|   |   |   |   |   |   UIViewControllerWrapperView:0x137d64520
|   |   |   |   |   |   |   •UIView:0x137ee7d50
|   |   |   |   |   |   |   |   *<UILayoutGuide: 0x2832fad80 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 20}, {414, 667}}, owningView = <UIView: 0x137ee7d50; frame = (0 0; 414 736); autoresize = W+H; layer = <CALayer: 0x280b09ac0>>>
|   |   |   |   |   |   |   |   *UIView:0x137ee7f30
|   |   |   |   |   |   |   |   *UIView:0x137ee8110
|   |   |   |   |   |   |   |   |   *UISegmentedControl:0x137ee59c0 alignmentRect = (65 16; 284 28) for frame = (65 16; 284 29);
|   |   |   |   |   |   |   |   |   |   UISegment:0x137ee5c30
|   |   |   |   |   |   |   |   |   |   |   UISegmentLabel:0x137ee5ed0'AUTO ADD HISTORY'
|   |   |   |   |   |   |   |   |   |   |   UIImageView:0x137ee6510
|   |   |   |   |   |   |   |   |   |   UISegment:0x137dbb4d0
|   |   |   |   |   |   |   |   |   |   |   UISegmentLabel:0x137dbba00'AUTO ADD ON'
|   |   |   |   |   |   |   |   |   |   |   UIImageView:0x137dbc320
|   |   |   |   |   |   |   |   |   |   UISegment:0x137ee6740
|   |   |   |   |   |   |   |   |   |   |   UISegmentLabel:0x137ee69e0'ALL'
|   |   |   |   |   |   |   |   |   |   |   UIImageView:0x137ee6cd0
|   |   |   |   |   |   |   |   |   *UILabel:0x137ee7070'Swipe "Right" to send ite...'
|   |   |   |   |   |   |   |   |   *UIView:0x137ee82f0
|   |   |   |   |   |   |   |   |   |   *UIView:0x137ee84d0
|   |   |   |   |   |   |   |   |   |   |   *UIView:0x137ee86b0
|   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x137ee5060'Item/Purchase Dt'
|   |   |   |   |   |   |   |   |   |   |   |   |   UIButtonLabel:0x137dc4110'Item/Purchase Dt'
|   |   |   |   |   |   |   |   |   |   |   *UIView:0x137ee8890
|   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x137ee8a70
|   |   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x137ee56a0'QTY'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   UIButtonLabel:0x137dc3e10'QTY'
|   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x137dbcfd0
|   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x137dbd1b0
|   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x137ee5380'Expiry'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   UIButtonLabel:0x137dc3b10'Expiry'
|   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x137dbd390
|   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x137ee4940'Buy Again'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   UIButtonLabel:0x137dc2c00'Buy Again'
|   |   |   |   |   |   |   |   |   *UITableView:0x1389a6800
|   |   |   |   |   |   |   |   |   |   HIRING_App.ItemPantryListCell:0x1389dda00
|   |   |   |   |   |   |   |   |   |   |   •UITableViewCellContentView:0x139bc09b0, MISSING HOST CONSTRAINTS
|   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x139bc0ba0
|   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x139bc0d80
|   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x139bc0f60
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x139bc1140'transaxle'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x139bc1430'02/21/2020'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x139bc1720
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x139bc1900
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x139bc1ae0'1 Item'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x139bc1dd0
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x139bc1fb0
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIStackView:0x139bc2190
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *<_UILayoutSpacer: 0x2834f5860 - "UISV-alignment-spanner", layoutFrame = {{0, 0}, {75.333333333333329, 0}}, owningView = <UIStackView: 0x139bc2190; frame = (0 37.5; 75.5 32.5); opaque = NO; autoresize = RM+BM; layer = <CATransformLayer: 0x280a94dc0>>>- AMBIGUOUS LAYOUT for _UILayoutSpacer:0x2834f5860'UISV-alignment-spanner'.minY{id: 7931}, _UILayoutSpacer:0x2834f5860'UISV-alignment-spanner'.Height{id: 7932}
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x139bc2390'Label'- AMBIGUOUS LAYOUT for UILabel:0x139bc2390'Label'.minY{id: 7863}
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x139bc2680' Expiry Alert'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIView:0x139cc16c0
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIStackView:0x139cc2150
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *<_UILayoutSpacer: 0x2834f11d0 - "UISV-alignment-spanner", layoutFrame = {{0, 0}, {104, 0}}, owningView = <UIStackView: 0x139cc2150; frame = (4 18.5; 104 70); opaque = NO; autoresize = RM+BM; layer = <CATransformLayer: 0x280a91460>>>- AMBIGUOUS LAYOUT for _UILayoutSpacer:0x2834f11d0'UISV-alignment-spanner'.minY{id: 7960}, _UILayoutSpacer:0x2834f11d0'UISV-alignment-spanner'.Height{id: 7961}
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UILabel:0x139cc2350- AMBIGUOUS LAYOUT for UILabel:0x139cc2350.minY{id: 7906}
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x139bc2c40'Auto Add'
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x139bc37c0
|   |   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x139cc3d80
|   |   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x139bc67f0
|   |   |   |   |   |   |   |   |   |   |   |   |   *UIButton:0x139cc40a0
|   |   |   |   |   |   |   |   |   |   |   |   |   |   UIImageView:0x139bc6a20
|   |   |   |   |   |   |   |   |   |   |   _UITableViewCellSeparatorView:0x139bc29a0
|   |   |   |   |   |   |   |   |   |   UIImageView:0x137ef5b00
|   |   |   |   |   |   |   |   |   |   UIImageView:0x137ef5d30
|   |   UITabBar:0x137d3eb00
|   |   |   _UIBarBackground:0x137d402a0
|   |   |   |   UIImageView:0x137d40730
|   |   |   |   UIVisualEffectView:0x137d40960
|   |   |   |   |   _UIVisualEffectBackdropView:0x137e17780
|   |   |   |   |   _UIVisualEffectSubview:0x137e412b0
|   |   |   UITabBarButton:0x137e4f830
|   |   |   |   UITabBarSwappableImageView:0x137d281a0
|   |   |   |   UITabBarButtonLabel:0x137e4fb50'MY LISTS'
|   |   |   |   _UIBadgeView:0x137d5e7f0
|   |   |   |   |   UIImageView:0x137d60290
|   |   |   |   |   UILabel:0x137d5f4b0'1'
|   |   |   UITabBarButton:0x137d3f0d0
|   |   |   |   UITabBarSwappableImageView:0x137d3f900
|   |   |   |   UITabBarButtonLabel:0x137d3f5e0'CART'
|   |   |   |   _UIBadgeView:0x137d60ac0
|   |   |   |   |   UIImageView:0x137d60cd0
|   |   |   UITabBarButton:0x137e50380
|   |   |   |   UITabBarSwappableImageView:0x137e50bb0
|   |   |   |   UITabBarButtonLabel:0x137e50890'PANTRY'
|   |   |   |   _UIBadgeView:0x137d60f00
|   |   |   |   |   UIImageView:0x137d61110
|   |   |   |   |   UILabel:0x139cae990'1'
|   |   |   UITabBarButton:0x137e50e00
|   |   |   |   UITabBarSwappableImageView:0x137e51630
|   |   |   |   UITabBarButtonLabel:0x137e51310'TODO'
|   |   |   |   _UIBadgeView:0x137d61340
|   |   |   |   |   UIImageView:0x137d61550
|   |   |   UITabBarButton:0x137e51880
|   |   |   |   UITabBarSwappableImageView:0x137e520b0
|   |   |   |   UITabBarButtonLabel:0x137e51d90'MORE'

Legend:
    * - is laid out with auto layout
    + - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
    • - layout engine host
A.s.ALI
  • 1,992
  • 3
  • 22
  • 54
  • 2
    You can add ids to your constraints in Interface Builder. In this way, you can find the broken constraint in the console output. Open your ViewController in storyboard > choose constraints and add ids. And then you should run the project and open the view controller, now you can see broken constraints ids in console output. This will help you https://stackoverflow.com/questions/36880449/how-to-use-constraint-identifiers-in-autolayout-and-how-to-change-constrain-usin – emrcftci Feb 21 '20 at 06:48
  • looks interesting. But dont you think giving ids to each constraint is too cumbersome? is there any other way that I should I also know? – A.s.ALI Feb 21 '20 at 06:53
  • @A.s.ALI -- is the block of constraints you posted followed by a `Will attempt to recover by breaking constraint ...` followed by a ` – DonMag Feb 21 '20 at 13:41
  • @DonMag Sorry dude for being late. And I did not get what you asked for..... :/ – A.s.ALI Feb 24 '20 at 12:25
  • @A.s.ALI - can you post screen-shots of your cell design? Does the cell render as expected, even with the constraint warnings? It would be *really* helpful if you can run your app again and post the additional information. – DonMag Feb 24 '20 at 13:21
  • yes, the screen shot is appearing as expected – A.s.ALI Feb 25 '20 at 09:27

0 Answers0