AVPlayerViewController - No Auto Layout - Unable to simultaneously satisfy constraints.
As per this answer Unable to simultaneously satisfy constraints Warnings with AVPlayerViewController embedded in storyboard the solution seems to be to set showsPlayBackControls off on the PlayerController and then add it to the view.
Once you have an AVPlayer item, you can show the player controls again (assuming you need them).
I suspect that a valid AVPlayer item is needed in order for the player control constraints to be properly satisfied.
I had this exact same issue and managed to fix it by making this change. Good luck!
Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want
This is a common issue, particularly when using UIStackView
s in table view cells.
The problem is that as auto-layout is "doing its thing," it has to make several passes to calculate the complete layout.
When it encounters a stack view in a (non-fixed-height) cell, it needs to deal with the various heights of the stackView's arranged subviews, the table width and height, and the cell height. In addition, because a point on a @2x
scale device uses 2 pixels, and on a @3x
scale device it uses 3 pixels, auto-layout has to manipulate heights around one-half-points and one-third-points, respectively.
I think I would say it's not surprising that at some point during those calculations auto-layout prints error / warning messages to the console.
Setting the Priority
on the stack view's Bottom constraint to 999
allows auto-layout to, I guess, temporarily break the constraint without coughing up the warning.
So... is it a Bug? Or is it Unavoidable? Only Apple knows for sure. :)
iOS Unable to simultaneously satisfy constraints
The list of the conflicting constraints includes h=--& v=--&
which is the default non-autolayout form.
I was trying to get the initial size and position using auto-layout, and then tried to turn auto-layout off by setting translatesAutoresizingMaskIntoConstraints=YES. I got an answer in the Apple developer forum saying that in such case I need to remove all constraints for the view, possibly by removing from the superview and adding back.
TIP
While investigating this bug, I have found a way to make the constraints-conflict log much easier to understand. The problem is that the views appear anonymous, specifying only the class but not the name.
To make your views identifiable, open one of your .m
files and add a new class for each view you want to identify, like this:
@interface ImgWhiteBar: UIImageView
@end
@implementation ImgWhiteBar
@end
@interface Spacer1: UIView
@end
@implementation Spacer1
@end
After that, in InterfaceBuilder, select each view, and then at the "Identity Inspector" on the right modify the generic class (UIVIew, UIImageView etc.) into one of the classes you just created.
Now run again, and Abracadabra - all views are now identified with their custom classes, allowing you to understand what is going on there.
Have fun debugging constraints!
Related Topics
Union Uibezierpaths Rather Than Apend Path
Disable Bounce Effect in Uipageviewcontroller
Xcode 4.2: How to Import .H File from Subproject
Swiftui: Deleting Last Row in Foreach
How to Observe Changes in Userdefaults
How to Convert Date Like \/Date(1440156888750-0700)\/ to Something That Swift Can Handle
Xcode 8.1 Push Notifications in Swift 2.3 with Firebase Integration Not Getting
How to Get Word Wrap Information with the New iOS 7 APIs
Confused About Orthographic Projection of Camera in Scenekit
Delivery Report of Sending Remote Push Notifications Using Apns - iOS
Uitableviewcell Imageview Changing on Select
Swift/How to Use Dispatch_Group with Multiple Called Web Service
Have a Variable with Multiple Types in Swift
How to Convert Bytes to a Float Value in Swift
My Swift 4 Uiscrollview with Autolayout Constraints Is Not Scrolling