无法同时满足在情节提要中嵌入 AVPlayerViewController 的约束警告 [英] Unable to simultaneously satisfy constraints Warnings with AVPlayerViewController embedded in storyboard

查看:16
本文介绍了无法同时满足在情节提要中嵌入 AVPlayerViewController 的约束警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过嵌入单独的视图控制器来完全通过情节提要设置 AVPlayerViewController.

I'm trying to set up an AVPlayerViewController completely through storyboards by embedding in a separate View Controller.

步骤:

  1. 在 Xcode 中创建单视图应用程序.
  2. 在导航控制器中嵌入 VC.
  3. 在底部添加工具栏.(固定到superView(Leading,Trailing,Bottom Layout Guide,Height(44)).
  4. 在父视图控制器中添加容器视图.(固定到超级视图(前导,尾随),顶部布局指南,工具栏顶部).
  5. 移除容器视图自带的默认视图控制器.
  6. 从对象库中拖动 AV Player View Controller 对象.
  7. 将 Container View 的 embed segue 连接到 AV Player View Controller.

未添加代码.

这就是我的故事板的样子:

查看层次结构:

一切正常:但问题是:一旦我运行它,我就会在调试器中收到这些警告:

Everything runs fine: BUT THE PROBLEM IS: As soon as i run it I get these warnings in the debugger:

2015-09-30 12:58:35.904 AVPlayerTest[9352:446772] 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:0x7f93259513b0 h=-&- v=-&- _UIBackdropContentView:0x7f9325860000.width == _UIBackdropView:0x7f932585e990.width>",
    "<NSLayoutConstraint:0x7f932592bc70 H:|-(14)-[UILabel:0x7f9325925590'Hi-Speed Scrubbing']   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592bcf0 H:[UILabel:0x7f9325925590'Hi-Speed Scrubbing']-(14)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592b770 H:|-(0)-[_UIBackdropView:0x7f932585e990]   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b7f0 H:[_UIBackdropView:0x7f932585e990]-(0)-|   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b450 H:|-(0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b4d0 H:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932594aa10 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f932592bcf0 H:[UILabel:0x7f9325925590'Hi-Speed Scrubbing']-(14)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>

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.
2015-09-30 12:58:35.905 AVPlayerTest[9352:446772] 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:0x7f93259513b0 h=-&- v=-&- _UIBackdropContentView:0x7f9325860000.width == _UIBackdropView:0x7f932585e990.width>",
    "<NSLayoutConstraint:0x7f932592bdd0 H:|-(14)-[UILabel:0x7f9325929bb0'Slide your finger up to a...']   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592be50 H:[UILabel:0x7f9325929bb0'Slide your finger up to a...']-(14)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592b770 H:|-(0)-[_UIBackdropView:0x7f932585e990]   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b7f0 H:[_UIBackdropView:0x7f932585e990]-(0)-|   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b450 H:|-(0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b4d0 H:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932594aa10 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f932592be50 H:[UILabel:0x7f9325929bb0'Slide your finger up to a...']-(14)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>

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.
2015-09-30 12:58:35.906 AVPlayerTest[9352:446772] 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:0x7f932592b5e0 V:|-(>=0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b660 V:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592af50 V:[UIView:0x7f932585e830(44)]>",
    "<NSLayoutConstraint:0x7f9325952c30 'UIView-Encapsulated-Layout-Height' V:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f932592b660 V:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>

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.
2015-09-30 12:58:35.907 AVPlayerTest[9352:446772] 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:0x7f93259513b0 h=-&- v=-&- _UIBackdropContentView:0x7f9325860000.width == _UIBackdropView:0x7f932585e990.width>",
    "<NSLayoutConstraint:0x7f932592ba00 H:|-(0)-[UIView:0x7f932585fbc0]   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592ba80 H:[UIView:0x7f932585fbc0]-(0)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592b770 H:|-(0)-[_UIBackdropView:0x7f932585e990]   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b7f0 H:[_UIBackdropView:0x7f932585e990]-(0)-|   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b450 H:|-(0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b4d0 H:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932582a040 H:|-(14)-[AVButton:0x7f93258609b0](LTR)   (Names: '|':UIView:0x7f932585fbc0 )>",
    "<NSLayoutConstraint:0x7f9325829f90 H:[AVButton:0x7f93258609b0]-(15)-[UILabel:0x7f932347dc20'--:--'](LTR)>",
    "<NSLayoutConstraint:0x7f9325839550 H:[UILabel:0x7f932347dc20'--:--']-(12)-[AVScrubber:0x7f93234a4350](LTR)>",
    "<NSLayoutConstraint:0x7f932585a2f0 AVScrubber:0x7f93234a4350.right == UILabel:0x7f932583a470'--:--'.left - 12>",
    "<NSLayoutConstraint:0x7f932580b390 UILabel:0x7f932583a470'--:--'.right == AVButton:0x7f932585e480.left - 15>",
    "<NSLayoutConstraint:0x7f932586f490 AVButton:0x7f932585e480.right == AVButton:0x7f93234d1790.left - 10>",
    "<NSLayoutConstraint:0x7f932580b340 AVButton:0x7f93234d1790.right == AVButton:0x7f93234d6540.left - 10>",
    "<NSLayoutConstraint:0x7f932584c870 AVButton:0x7f93234d6540.right == UIView:0x7f932585fbc0.right - 14>",
    "<NSLayoutConstraint:0x7f932594aa10 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f9325829f90 H:[AVButton:0x7f93258609b0]-(15)-[UILabel:0x7f932347dc20'--:--'](LTR)>

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.
2015-09-30 12:58:35.909 AVPlayerTest[9352:446772] 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:0x7f93259513b0 h=-&- v=-&- _UIBackdropContentView:0x7f9325860000.width == _UIBackdropView:0x7f932585e990.width>",
    "<NSLayoutConstraint:0x7f932592ba00 H:|-(0)-[UIView:0x7f932585fbc0]   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592ba80 H:[UIView:0x7f932585fbc0]-(0)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592b770 H:|-(0)-[_UIBackdropView:0x7f932585e990]   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b7f0 H:[_UIBackdropView:0x7f932585e990]-(0)-|   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b450 H:|-(0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b4d0 H:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932582a040 H:|-(14)-[AVButton:0x7f93258609b0](LTR)   (Names: '|':UIView:0x7f932585fbc0 )>",
    "<NSLayoutConstraint:0x7f932586f490 AVButton:0x7f932585e480.right == AVButton:0x7f93234d1790.left - 10>",
    "<NSLayoutConstraint:0x7f932580b340 AVButton:0x7f93234d1790.right == AVButton:0x7f93234d6540.left - 10>",
    "<NSLayoutConstraint:0x7f932584c870 AVButton:0x7f93234d6540.right == UIView:0x7f932585fbc0.right - 14>",
    "<NSLayoutConstraint:0x7f9325859740 H:[AVButton:0x7f93258609b0]-(>=15)-[UILabel:0x7f93234e53f0'Live Broadcast'](LTR)>",
    "<NSLayoutConstraint:0x7f932583bea0 UILabel:0x7f93234e53f0'Live Broadcast'.right <= AVButton:0x7f932585e480.left - 15>",
    "<NSLayoutConstraint:0x7f932594aa10 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f9325859740 H:[AVButton:0x7f93258609b0]-(>=15)-[UILabel:0x7f93234e53f0'Live Broadcast'](LTR)>

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.
2015-09-30 12:58:35.910 AVPlayerTest[9352:446772] 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:0x7f93259513b0 h=-&- v=-&- _UIBackdropContentView:0x7f9325860000.width == _UIBackdropView:0x7f932585e990.width>",
    "<NSLayoutConstraint:0x7f9323520650 H:|-(0)-[UIActivityIndicatorView:0x7f93234e6ee0]   (Names: '|':UIView:0x7f93234e6120 )>",
    "<NSLayoutConstraint:0x7f93235206a0 H:[UIActivityIndicatorView:0x7f93234e6ee0]-(10)-[UILabel:0x7f93235203b0'LoadingU2026']>",
    "<NSLayoutConstraint:0x7f9323520740 H:[UILabel:0x7f93235203b0'LoadingU2026']-(0)-|   (Names: '|':UIView:0x7f93234e6120 )>",
    "<NSLayoutConstraint:0x7f9323521f90 H:|-(>=0)-[UIView:0x7f93234e6120]   (Names: '|':AVLoadingIndicatorView:0x7f93234e5fb0 )>",
    "<NSLayoutConstraint:0x7f9323510da0 UIView:0x7f93234e6120.centerX == AVLoadingIndicatorView:0x7f93234e5fb0.centerX>",
    "<NSLayoutConstraint:0x7f932592ba00 H:|-(0)-[UIView:0x7f932585fbc0]   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592ba80 H:[UIView:0x7f932585fbc0]-(0)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592b770 H:|-(0)-[_UIBackdropView:0x7f932585e990]   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b7f0 H:[_UIBackdropView:0x7f932585e990]-(0)-|   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b450 H:|-(0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b4d0 H:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932582a040 H:|-(14)-[AVButton:0x7f93258609b0](LTR)   (Names: '|':UIView:0x7f932585fbc0 )>",
    "<NSLayoutConstraint:0x7f932586f490 AVButton:0x7f932585e480.right == AVButton:0x7f93234d1790.left - 10>",
    "<NSLayoutConstraint:0x7f932580b340 AVButton:0x7f93234d1790.right == AVButton:0x7f93234d6540.left - 10>",
    "<NSLayoutConstraint:0x7f932584c870 AVButton:0x7f93234d6540.right == UIView:0x7f932585fbc0.right - 14>",
    "<NSLayoutConstraint:0x7f932583bbc0 H:[AVButton:0x7f93258609b0]-(>=15)-[AVLoadingIndicatorView:0x7f93234e5fb0](LTR)>",
    "<NSLayoutConstraint:0x7f932583bc10 AVLoadingIndicatorView:0x7f93234e5fb0.right <= AVButton:0x7f932585e480.left - 15>",
    "<NSLayoutConstraint:0x7f932594aa10 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f93235206a0 H:[UIActivityIndicatorView:0x7f93234e6ee0]-(10)-[UILabel:0x7f93235203b0'Loading…']>

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.
2015-09-30 12:58:35.912 AVPlayerTest[9352:446772] 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:0x7f93259513b0 h=-&- v=-&- _UIBackdropContentView:0x7f9325860000.width == _UIBackdropView:0x7f932585e990.width>",
    "<NSLayoutConstraint:0x7f9323521f90 H:|-(>=0)-[UIView:0x7f93234e6120]   (Names: '|':AVLoadingIndicatorView:0x7f93234e5fb0 )>",
    "<NSLayoutConstraint:0x7f9323510da0 UIView:0x7f93234e6120.centerX == AVLoadingIndicatorView:0x7f93234e5fb0.centerX>",
    "<NSLayoutConstraint:0x7f932592ba00 H:|-(0)-[UIView:0x7f932585fbc0]   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592ba80 H:[UIView:0x7f932585fbc0]-(0)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592b770 H:|-(0)-[_UIBackdropView:0x7f932585e990]   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b7f0 H:[_UIBackdropView:0x7f932585e990]-(0)-|   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b450 H:|-(0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b4d0 H:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932582a040 H:|-(14)-[AVButton:0x7f93258609b0](LTR)   (Names: '|':UIView:0x7f932585fbc0 )>",
    "<NSLayoutConstraint:0x7f932586f490 AVButton:0x7f932585e480.right == AVButton:0x7f93234d1790.left - 10>",
    "<NSLayoutConstraint:0x7f932580b340 AVButton:0x7f93234d1790.right == AVButton:0x7f93234d6540.left - 10>",
    "<NSLayoutConstraint:0x7f932584c870 AVButton:0x7f93234d6540.right == UIView:0x7f932585fbc0.right - 14>",
    "<NSLayoutConstraint:0x7f932583bbc0 H:[AVButton:0x7f93258609b0]-(>=15)-[AVLoadingIndicatorView:0x7f93234e5fb0](LTR)>",
    "<NSLayoutConstraint:0x7f932583bc10 AVLoadingIndicatorView:0x7f93234e5fb0.right <= AVButton:0x7f932585e480.left - 15>",
    "<NSLayoutConstraint:0x7f932594aa10 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f9323510da0 UIView:0x7f93234e6120.centerX == AVLoadingIndicatorView:0x7f93234e5fb0.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.
2015-09-30 12:58:35.912 AVPlayerTest[9352:446772] 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:0x7f93259513b0 h=-&- v=-&- _UIBackdropContentView:0x7f9325860000.width == _UIBackdropView:0x7f932585e990.width>",
    "<NSLayoutConstraint:0x7f9323521f90 H:|-(>=0)-[UIView:0x7f93234e6120]   (Names: '|':AVLoadingIndicatorView:0x7f93234e5fb0 )>",
    "<NSLayoutConstraint:0x7f9323510d10 H:[UIView:0x7f93234e6120]-(>=0)-|   (Names: '|':AVLoadingIndicatorView:0x7f93234e5fb0 )>",
    "<NSLayoutConstraint:0x7f932592ba00 H:|-(0)-[UIView:0x7f932585fbc0]   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592ba80 H:[UIView:0x7f932585fbc0]-(0)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592b770 H:|-(0)-[_UIBackdropView:0x7f932585e990]   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b7f0 H:[_UIBackdropView:0x7f932585e990]-(0)-|   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b450 H:|-(0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b4d0 H:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932582a040 H:|-(14)-[AVButton:0x7f93258609b0](LTR)   (Names: '|':UIView:0x7f932585fbc0 )>",
    "<NSLayoutConstraint:0x7f932586f490 AVButton:0x7f932585e480.right == AVButton:0x7f93234d1790.left - 10>",
    "<NSLayoutConstraint:0x7f932580b340 AVButton:0x7f93234d1790.right == AVButton:0x7f93234d6540.left - 10>",
    "<NSLayoutConstraint:0x7f932584c870 AVButton:0x7f93234d6540.right == UIView:0x7f932585fbc0.right - 14>",
    "<NSLayoutConstraint:0x7f932583bbc0 H:[AVButton:0x7f93258609b0]-(>=15)-[AVLoadingIndicatorView:0x7f93234e5fb0](LTR)>",
    "<NSLayoutConstraint:0x7f932583bc10 AVLoadingIndicatorView:0x7f93234e5fb0.right <= AVButton:0x7f932585e480.left - 15>",
    "<NSLayoutConstraint:0x7f932594aa10 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f9323510d10 H:[UIView:0x7f93234e6120]-(>=0)-|   (Names: '|':AVLoadingIndicatorView:0x7f93234e5fb0 )>

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.
2015-09-30 12:58:35.913 AVPlayerTest[9352:446772] 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:0x7f93259513b0 h=-&- v=-&- _UIBackdropContentView:0x7f9325860000.width == _UIBackdropView:0x7f932585e990.width>",
    "<NSLayoutConstraint:0x7f932592ba00 H:|-(0)-[UIView:0x7f932585fbc0]   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592ba80 H:[UIView:0x7f932585fbc0]-(0)-|   (Names: '|':_UIBackdropContentView:0x7f9325860000 )>",
    "<NSLayoutConstraint:0x7f932592b770 H:|-(0)-[_UIBackdropView:0x7f932585e990]   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b7f0 H:[_UIBackdropView:0x7f932585e990]-(0)-|   (Names: '|':UIView:0x7f932585e830 )>",
    "<NSLayoutConstraint:0x7f932592b450 H:|-(0)-[UIView:0x7f932585e830]   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932592b4d0 H:[UIView:0x7f932585e830]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7f932585e310 )>",
    "<NSLayoutConstraint:0x7f932582a040 H:|-(14)-[AVButton:0x7f93258609b0](LTR)   (Names: '|':UIView:0x7f932585fbc0 )>",
    "<NSLayoutConstraint:0x7f932586f490 AVButton:0x7f932585e480.right == AVButton:0x7f93234d1790.left - 10>",
    "<NSLayoutConstraint:0x7f932580b340 AVButton:0x7f93234d1790.right == AVButton:0x7f93234d6540.left - 10>",
    "<NSLayoutConstraint:0x7f932584c870 AVButton:0x7f93234d6540.right == UIView:0x7f932585fbc0.right - 14>",
    "<NSLayoutConstraint:0x7f932583bbc0 H:[AVButton:0x7f93258609b0]-(>=15)-[AVLoadingIndicatorView:0x7f93234e5fb0](LTR)>",
    "<NSLayoutConstraint:0x7f932583bc10 AVLoadingIndicatorView:0x7f93234e5fb0.right <= AVButton:0x7f932585e480.left - 15>",
    "<NSLayoutConstraint:0x7f932594aa10 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7f932585e310(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f932583bbc0 H:[AVButton:0x7f93258609b0]-(>=15)-[AVLoadingIndicatorView:0x7f93234e5fb0](LTR)>

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.

很抱歉,日志太长了,但所有内容都立即出现,因此包括在内.我错过了什么?自动布局工作得很好.即使在旋转.为什么我会看到这些警告?

Sorry for the long Log, but all of it comes up at once so including it. What am I missing? Auto layout is working great. Even on rotation. Why am I seeing these warnings?

添加了示例项目

P.S.:使用 Xcode 7.0 版

P.S.: Using Xcode Version 7.0

更新

取消选中 Shows Playback Controls 在属性检查器中的 AVPlayerViewController 上以某种方式修复它,我看不到任何警告.但我需要控制.似乎越来越像一个错误.

Unchecking Shows Playback Controls on the AVPlayerViewController in the Attributes Inspector fixes it somehow and I see no warnings. But I need the controls. Seems more and more like a bug.

推荐答案

其实我觉得是苹果这边的bug.

In fact, I think it's bug on Apple side.

我找到了一个解决方法:在设置 AVPlayerViewController.player 后将 showPlaybackControls 设置为 YES.

I found a workaround : set showsPlaybackControls to YES after the AVPlayerViewController.player have been set.

我用以下几行修改了您的示例,不再出现约束错误:

I modify your sample with the following lines and no more Constraint error appears :

@interface ViewController ()

@property(weak, nonatomic) AVPlayerViewController * playerViewController;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mp4"];
    NSURL *url = [[NSURL alloc] initFileURLWithPath: path];
    AVPlayer * player = [AVPlayer playerWithURL:url];

    self.playerViewController.player = player;
    self.playerViewController.showsPlaybackControls = YES;
}


- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"AVPlayerSegue"]) {
        self.playerViewController = segue.destinationViewController;
    }
}


@end

请注意,test.mp4 文件已添加到项目中.

Please note that the file test.mp4 have been added to the project.

这篇关于无法同时满足在情节提要中嵌入 AVPlayerViewController 的约束警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆