无法同时满足约束embedded在故事板中的AVPlayerViewController的警告

我试图通过embedded一个单独的视图控制器完全通过故事板设置一个AVPlayerViewController。

脚步:

  1. 在Xcode中创build单一视图应用程序。
  2. 将VCembedded到导航控制器中。
  3. 在底部添加工具栏(固定到超级视图(前导,尾随,底部布局指南,高度(44))。
  4. 在父视图控制器中添加容器视图(固定到超视图(前导,尾随),顶部布局指南,工具栏顶部)。
  5. 删除容器视图附带的默认视图控制器。
  6. 从对象库拖动AV Player视图控制器对象。
  7. 将容器视图中的embedded式Segue连接到AV播放器视图控制器。

没有添加代码。

这是我的故事板的样子:

在这里输入图像说明

查看层次:

在这里输入图像说明

一切运行良好: 但问题是:只要我运行它,我得到这些警告在debugging器中:

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'Loading\U2026']>", "<NSLayoutConstraint:0x7f9323520740 H:[UILabel:0x7f93235203b0'Loading\U2026']-(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. 

对不起,很长的日志,但所有这一切都出现了,所以包括它。 我错过了什么? 自动布局运作良好。 即使在旋转。 为什么我看到这些警告?

新增示例项目

PS :使用Xcode版本7.0

UPDATE

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

事实上,我认为这是苹果方面的错误。

我find了一个解决方法:设置AVPlayerViewController.player后,将showsPlaybackControls设置为YES。

我用下面的行修改你的示例,不再出现约束错误:

 @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已被添加到项目中。

我下载了你的代码,并看看它。 你没有做错什么。 您可以取消选中“显示回放控制”的事实似乎表明问题在于AVKit框架。 我甚至尝试在XIB文件中将该值设置为false,然后调用[self setShowsPlaybackControls:YES]; 之后viewDidAppear:具有相同的结果。 这绝对是一个苹果的错误,你应该提出一个错误报告。

在我的情况下,我只允许在iPhone上的肖像模式,而我想AVPlayerViewController具有所有的方向。

AppDelegate我看起来像这样的代码:

 public func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask { if self.window?.rootViewController?.presentedViewController is AVPlayerViewController { return .All } return Device.current.contains(.iPhone) ? [.Portrait, .PortraitUpsideDown] : .All } 

AVPlayerViewController呈现模态,旋转到风景和解散我会得到一个非常smiler错误堆栈,一些约束破坏。

要解决这个问题,我将这段代码添加到我的RootViewController ,该代码还在我的应用程序中显示了AVPlayerViewController任何实例:

 public override func dismissViewControllerAnimated(flag: Bool, completion: (() -> Void)?) { if let playerViewController = self.presentedViewController as? AVPlayerViewController { playerViewController.showsPlaybackControls = false } super.dismissViewControllerAnimated(flag, completion: completion) } 

基本上我抓住了用户点击closuresbutton,并使用原来的问题postfind解决方法的时刻。

不幸的是,这个错误仍然存​​在于ios 10.1中。 无论如何,我已经观察到,如果我将seekTime设置为0的视图控制器,错误不存在。 因此,我的解决scheme是暂停播放器,保留当前时间,寻找播放器0,呈现控制器,并在完成后执行以下操作:寻找保留的时间并再次播放。

 AVPlayer *player; AVPlayerViewController *avPlayerController; CMTime currentTime; - (void)viewDidLoad { [super viewDidLoad]; NSURL *videoURL = [NSURL URLWithString:@"https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"]; player = [AVPlayer playerWithURL:videoURL]; AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player]; [self.playerView.layer addSublayer:playerLayer]; playerLayer.frame = self.playerView.bounds; avPlayerController = [[AVPlayerViewController alloc] init]; avPlayerController.player = player; } - (IBAction)fullScreen:(id)sender { [player pause]; currentTime = player.currentTime; [player seekToTime:CMTimeMake(0, 1)]; [self presentViewController:avPlayerController animated:YES completion:^{ [avPlayerController.player seekToTime:currentTime]; [avPlayerController.player play]; }]; } 

我意识到这是发生在您尝试呈现相同的AVPlayerViewController实例(使用强引用属性)第二,第三…等时间和播放器控件不重置(即进展不在开始)。

进度条不在0:00

实际上,如果您正面临相同的情况,则在点击“完成”之前,尝试将进度条拖到开头,然后再次呈现AVPlayerViewController。 那么自动布局问题应该消失!

所以基本上Autolayout问题(顺便说一下,苹果的问题)可以解决,如果您解除AVPlayerViewController之前重置控件。 但是,如果你想呈现相同的video呢? 在我的情况下,我想保持对AVPlayerItem的引用:

 @property (strong, nonatomic) AVPlayerItem *playerItem; 

但是我不想让这个崩溃发生:

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An AVPlayerItem cannot be associated with more than one instance of AVPlayer' *** First throw call stack: (0x184035900 0x1836a3f80 0x18a254958 0x18a23fc14 0x100054a2c 0x188d5fe50 0x188d5fdcc 0x188d47a88 0x188d5f6e4 0x188d18294 0x188d58820 0x188d57e1c 0x188d284cc 0x188d26794 0x183fecefc 0x183fec990 0x183fea690 0x183f19680 0x185428088 0x188d90d90 0x1000eea78 0x183aba8b8) libc++abi.dylib: terminating with uncaught exception of type NSException 

所以我的解决方法是每次推AVPlayerViewController时创build一个AVPLayerItem的副本。 这样,崩溃和自动布局问题就没有了。 但是,每次按下播放器时都会重置video。

 AVPlayerViewController *playerViewController = [AVPlayerViewController new]; playerViewController.player = [[AVPlayer alloc] initWithPlayerItem:self.playerItem.copy]; 

这个警告是说你已经使用了一个不需要使用的约束。

ToolBarHeight在默认情况下是44,对于所有的iPhone设备,在这里你已经使用UIToolBar高度约束。 所以工具栏高度约束是额外的,删除这个约束的警告将被自动删除