How to Simultaneously Satisfy Constraints Warnings with Avplayerviewcontroller Embedded in Storyboard

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 for view controller

My problem was that I was setting the height of the view after instantiating it, in the "viewDidLayoutSubviews".
I am using "Presentr" lib to instantiate a view easily.

My issue had nothing to do with constraints in the storyboard whatsoever.
I managed to fix the problem by specifying the height of my view BEFORE presenting with Presentr.
To do that, I did a protocol that forced my controller to have a "getHeight" func to get its height, allowing me to to something like that

let customType = PresentationType.custom(width: .custom(size: Float(self.view.frame.width)), height: .custom(size: editProfileVC.getHeight()), center: .center)

You can see here that, for the height, I'm using "editProfileVC.getHeight()"

I hope it can help others too.

Mixing storyboard and constraints in code

You can use layoutIfNeeded to get the autolayout triggered and have your views the correct size.

But your yellow views almost looks like you could use a UICollectionView to manage them...



Related Topics



Leave a reply



Submit