2

i am getting message on xCode Log when i lunch my app developed by Swift 4 , i have tableview have multiple different cell's about 12 different cell's , that warning message i am getting is :

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-08-21 09:27:57.404497+0300 muzeit[6449:2211903] [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:0x174481770 V:|-(0)-[UIImageView:0x107a09eb0]   (active, names: '|':UIView:0x107a09d10 )>",
    "<NSLayoutConstraint:0x174481860 V:[UIImageView:0x107a09eb0]-(-60)-|   (active, names: '|':UIView:0x107a09d10 )>",
    "<NSLayoutConstraint:0x1744818b0 UIImageView:0x107a09eb0.centerY == UIView:0x107a09d10.centerY   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1744818b0 UIImageView:0x107a09eb0.centerY == UIView:0x107a09d10.centerY   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-08-21 09:27:57.492890+0300 muzeit[6449:2211903] [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:0x17048b770 V:|-(0)-[UIImageView:0x107a30c30]   (active, names: '|':UIView:0x107a30a90 )>",
    "<NSLayoutConstraint:0x17048b860 V:[UIImageView:0x107a30c30]-(-60)-|   (active, names: '|':UIView:0x107a30a90 )>",
    "<NSLayoutConstraint:0x17048b8b0 UIImageView:0x107a30c30.centerY == UIView:0x107a30a90.centerY   (active)>"
)

I've tried to google it to find some solution how to solve it , i couldn't find clear answer , also the breakpoint dose not show the constraint has the issue !

any idea ?

Kodr.F
  • 13,932
  • 13
  • 46
  • 91
  • see this https://stackoverflow.com/questions/26389273/how-to-trap-on-uiviewalertforunsatisfiableconstraints – Anbu.Karthik Aug 21 '17 at 06:34
  • @Jack If your UIImageView has pin to top and bottom your center.Y constraint is not needed and is causing your constraint error, or you remove the center.Y constraint or both pins to top and bottom, easy as that, let me know if I am wrong – Reinier Melian Aug 21 '17 at 06:34
  • @ReinierMelian , thank you , i will try and let you know , my problem is the cell's has so many constraints because they are different from each others, anyway i will try your advice – Kodr.F Aug 21 '17 at 06:54
  • Check this... https://staxmanade.com/2015/06/debugging-ios-autolayout-issues/ I have resolved my issue from here. – Asif Raza Feb 25 '18 at 12:04

2 Answers2

1

If you want to better understand what the log is trying to tell you you can check the Visual Format Language. You can "translate" your log as follows:

V:|-(0)-[UIImageView:0x107a09eb0] = Set a vertical (V:) space of 0 points between the top of the superview (|) and the ImageView

V:[UIImageView:0x107a09eb0]-(-60)-| = Set a vertical (V:) space of -60 points between the bottom of the UIImageView and the superview (|)

UIImageView:0x107a09eb0.centerY == UIView:0x107a09d10.centerY (active) = Vertically center the UIImageView to the superview

With the translation it is now easier to understand that your UIImageView is pinned both top and bottom and this conflicts with the third constraint, that is trying to vertically center the UIImageView.

As suggested by @ReinerMeilan in the comments you can remove the centerY constraint to fix this autolayout issue.

SwissMark
  • 1,041
  • 12
  • 21
-1

you choose check your UI and your size of tableView in function or Check your fix constrain centre Y in your project you should delete some constrain or you can fix size from your code Controller

Papon Smc
  • 576
  • 4
  • 11