bobbyali / kidsvidz

KidsVidz - Simple and Safe iOS YouTube player for young children
0 stars 1 forks source link

Constraints break when closing player #14

Closed bobbyali closed 9 years ago

bobbyali commented 9 years ago

Get loads of warnings when the video player view shuts and the grid view controller reappears.

2015-03-24 14:10:50.413 KidzVids[6220:213637] 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) 
(
    "<NSLayoutConstraint:0x7f9a060dc690 UIView:0x7f9a060da600.centerX == AVExternalPlaybackIndicatorView:0x7f9a060da480.centerX>",
    "<NSLayoutConstraint:0x7f9a061783a0 H:|-(0)-[AVExternalPlaybackIndicatorView:0x7f9a060da480]   (Names: '|':UIView:0x7f9a03ce2350 )>",
    "<NSLayoutConstraint:0x7f9a061783f0 H:[AVExternalPlaybackIndicatorView:0x7f9a060da480]-(0)-|   (Names: '|':UIView:0x7f9a03ce2350 )>",
    "<NSLayoutConstraint:0x7f9a060ddc60 H:|-(0)-[UIView:0x7f9a03ce2350]   (Names: '|':UIView:0x7f9a060e8e60 )>",
    "<NSLayoutConstraint:0x7f9a060af780 H:[UIView:0x7f9a03ce2350]-(0)-|   (Names: '|':UIView:0x7f9a060e8e60 )>",
    "<NSLayoutConstraint:0x7f9a03e40010 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7f9a060e8e60(0)]>",
    "<NSLayoutConstraint:0x7f9a060dc880 H:|-(>=10)-[UIView:0x7f9a060da600]   (Names: '|':AVExternalPlaybackIndicatorView:0x7f9a060da480 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f9a060dc690 UIView:0x7f9a060da600.centerX == AVExternalPlaybackIndicatorView:0x7f9a060da480.centerX>

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.
bobbyali commented 9 years ago

The way I managed to get the video player to close is by adding this code to the YouTubePlayer module:

https://github.com/bobbyali/kidsvidz/blob/master/Libs/YouTubePlayer/YouTubePlayer/VideoPlayerView.swift#L325-L329

Is there something about clearing the HTML in the WebView that breaks some constraints? Is it somehow related to the fact that the grid view layout gets messed up when the view returns to the grid view? (see Issue #2 )