35
votes

Just updated to Xcode 7 and iOS 9 SDK and found a problem when playing the HTML 5 video in the UIWebview. The code is very simple, just load an HTML code in the UIWebview and play it. The HTML code includes a tag to play the video file in the bundle. When testing it on iPhone, the video can play properly in a fullscreen mode (as default), but the Xcode console displays a long list of the error message:

UIWebviewVideoTest[22503:904174] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)

(

 "<NSAutoresizingMaskLayoutConstraint:0x7f8df9da8ed0 h=-&- v=-&- _UIBackdropContentView:0x7f8dfc034370.width == _UIBackdropView:0x7f8df9c4ec70.width>",
"<NSLayoutConstraint:0x7f8df9d974e0 H:|-(14)-[UILabel:0x7f8df9c45b40'Slide your finger down to...']   (Names: '|':_UIBackdropContentView:0x7f8dfc034370 )>",
"<NSLayoutConstraint:0x7f8df9d96900 H:[UILabel:0x7f8df9c45b40'Slide your finger down to...']-(14)-|   (Names: '|':_UIBackdropContentView:0x7f8dfc034370 )>",
"<NSLayoutConstraint:0x7f8df9d835c0 H:|-(0)-[_UIBackdropView:0x7f8df9c4ec70]   (Names: '|':UIView:0x7f8df9c52bf0 )>",
"<NSLayoutConstraint:0x7f8df9d83610 H:[_UIBackdropView:0x7f8df9c4ec70]-(0)-|   (Names: '|':UIView:0x7f8df9c52bf0 )>",
"<NSLayoutConstraint:0x7f8df9d83910 H:|-(0)-[UIView:0x7f8df9c52bf0]   (Names: '|':AVAlphaUpdatingView:0x7f8df9c44190 )>",
"<NSLayoutConstraint:0x7f8df9d83960 H:[UIView:0x7f8df9c52bf0]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f8df9c44190 )>",
"<NSLayoutConstraint:0x7f8df9daf950 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f8df9c44190(0)]>"

)

Will attempt to recover by breaking the constraint

<NSLayoutConstraint:0x7f8df9d96900 H:[UILabel:0x7f8df9c45b40'Slide your finger down to...']-(14)-|   (Names: '|':_UIBackdropContentView:0x7f8dfc034370 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful.

When I test it on iPad, the inline play mode is OK, but when playing video in a fullscreen mode, a similar error was displayed in the console. It seems the error is associated with the fullscreen video play in a UIWebview. Does anyone know why this error message was generated and how to avoid it? Thanks!

1
There is no error message displayed when I test it in Xcode 6.3 and iOS 8 SDK with swift.Steve Wang
Can you please provide what constraints you have added to the webView. And also how you have instantiated it.Ishan Handa
I just added the top, bottom, leading and tailing constraints between the UIWebview and the root view to make a "margin" region. And there is only one subview (the UIWebview) in the root view.Steve Wang
If the UIWebView was added programmatically make sure translatesAutoresizingMaskIntoConstraints is set to NOIshan Handa
I am still facing same issue as of iOS 9.2. Anyone able to solve it ?Raj

1 Answers

1
votes

It's an Apple bug.

Bug was fixed in newer iOS versions.

If you still experience it - file a bug report to Apple.