首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AVPlayerView的约束错误

AVPlayerView的约束错误
EN

Stack Overflow用户
提问于 2015-11-03 21:57:17
回答 1查看 155关注 0票数 0

我正在尝试创建一个相对简单的应用程序,它只需在按钮被按下时播放视频。我使用的是AVKit的AVPlayer,看起来一切正常,但在运行程序时,我确实收到了有关约束的警告。

不确定我到底在哪里有一个约束,这导致了我的问题。

代码语言:javascript
复制
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:0x7ffc5acdc030 h=-&- v=-&- _UIBackdropContentView:0x7ffc5adc6d10.width == _UIBackdropView:0x7ffc5adbfd80.width>",
"<NSLayoutConstraint:0x7ffc5ad94a40 H:|-(0)-[UIView:0x7ffc5ad94e50]   (Names: '|':UIView:0x7ffc5ad35c90 )>",
"<NSLayoutConstraint:0x7ffc5ad94a90 H:[UIView:0x7ffc5ad94e50]-(0)-|   (Names: '|':UIView:0x7ffc5ad35c90 )>",
"<NSLayoutConstraint:0x7ffc5ad96720 H:|-(0)-[UIView:0x7ffc5ad35c90]   (Names: '|':AVPlayerView:0x7ffc5ad356e0 )>",
"<NSLayoutConstraint:0x7ffc5ad96770 H:[UIView:0x7ffc5ad35c90]-(0)-|   (Names: '|':AVPlayerView:0x7ffc5ad356e0 )>",
"<NSLayoutConstraint:0x7ffc5d068110 H:|-(0)-[UIView:0x7ffc5adc6890]   (Names: '|':_UIBackdropContentView:0x7ffc5adc6d10 )>",
"<NSLayoutConstraint:0x7ffc5d068190 H:[UIView:0x7ffc5adc6890]-(0)-|   (Names: '|':_UIBackdropContentView:0x7ffc5adc6d10 )>",
"<NSLayoutConstraint:0x7ffc5d067e80 H:|-(0)-[_UIBackdropView:0x7ffc5adbfd80]   (Names: '|':UIView:0x7ffc5adbeb70 )>",
"<NSLayoutConstraint:0x7ffc5d067f00 H:[_UIBackdropView:0x7ffc5adbfd80]-(0)-|   (Names: '|':UIView:0x7ffc5adbeb70 )>",
"<NSLayoutConstraint:0x7ffc5d067b30 H:|-(0)-[UIView:0x7ffc5adbeb70]   (Names: '|':AVAlphaUpdatingView:0x7ffc5adbd530 )>",
"<NSLayoutConstraint:0x7ffc5d067b80 H:[UIView:0x7ffc5adbeb70]-(0)-|   (Names: '|':AVAlphaUpdatingView:0x7ffc5adbd530 )>",
"<NSLayoutConstraint:0x7ffc5acd5b20 H:|-(34)-[AVButton:0x7ffc5adc76f0](LTR)   (Names: '|':UIView:0x7ffc5adc6890 )>",
"<NSLayoutConstraint:0x7ffc5acdccc0 H:[AVButton:0x7ffc5adc76f0]-(15)-[UILabel:0x7ffc5ac741a0'0:00'](LTR)>",
"<NSLayoutConstraint:0x7ffc5acdca20 H:[UILabel:0x7ffc5ac741a0'0:00']-(12)-[AVScrubber:0x7ffc5acb8ec0](LTR)>",
"<NSLayoutConstraint:0x7ffc5acdca70 AVScrubber:0x7ffc5acb8ec0.right == UILabel:0x7ffc5adf2ed0'--:--'.left - 12>",
"<NSLayoutConstraint:0x7ffc5acdcf00 UILabel:0x7ffc5adf2ed0'--:--'.right == AVButton:0x7ffc5adf3a70.left - 15>",
"<NSLayoutConstraint:0x7ffc5acdcfa0 AVButton:0x7ffc5adf3a70.right == AVButton:0x7ffc5d0051d0.left - 10>",
"<NSLayoutConstraint:0x7ffc5acdceb0 AVButton:0x7ffc5d0051d0.right == AVButton:0x7ffc5d00b190.left - 10>",
"<NSLayoutConstraint:0x7ffc5acdd240 AVButton:0x7ffc5d00b190.right == UIView:0x7ffc5adc6890.right - 34>",
"<NSLayoutConstraint:0x7ffc5adb15f0 H:|-(0)-[AVAlphaUpdatingView:0x7ffc5adbd530]   (Names: '|':UIView:0x7ffc5ad94e50 )>",
"<NSLayoutConstraint:0x7ffc5adb8460 H:[AVAlphaUpdatingView:0x7ffc5adbd530]-(0)-|   (Names: '|':UIView:0x7ffc5ad94e50 )>",
"<NSLayoutConstraint:0x7ffc5acd4c80 'UIView-Encapsulated-Layout-Width' H:[AVPlayerView:0x7ffc5ad356e0(100)]>"
)

项目在这里https://github.com/jeffellin/VideoPlayer

EN

回答 1

Stack Overflow用户

发布于 2015-12-25 14:22:24

在我将苹果的几个示例代码中的各种代码片段复制并粘贴到我的应用程序中后,我得到了相同的错误,但我还不知道您不能为一个UI元素指定相同的约束两次。

你可能做了同样的事情;所以,在整个项目范围内搜索“AutoResizing”。无论您在何处将playerView设置为根据其父视图、视图控制器或媒体自动调整自身大小。

我看了你的应用程序的代码,我没有看到任何地方调用了这个特定的方法。要么是我忽略了它,要么是你在发布这个问题后修复了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33500967

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档