Ios8 MPMoviePlayerController布局约束问题

Ios8 MPMoviePlayerController布局约束问题,ios8,autolayout,Ios8,Autolayout,我正在将一个应用程序移植到iOS 8。我有一些代码来播放一段视频,这段视频以前很管用,但现在不行了 运行时,会出现以下错误: ( "<NSLayoutConstraint:0x7faba2df5940 H:|-(34)-[MPKnockoutButton:0x7faba2e6d750](LTR) (Names: '|':_UIBackdropContentView:0x7faba2dc38c0 )>", "<NSLayoutConstraint:0x7faba2d5178

我正在将一个应用程序移植到iOS 8。我有一些代码来播放一段视频,这段视频以前很管用,但现在不行了

运行时,会出现以下错误:

(
"<NSLayoutConstraint:0x7faba2df5940 H:|-(34)-[MPKnockoutButton:0x7faba2e6d750](LTR)   (Names: '|':_UIBackdropContentView:0x7faba2dc38c0 )>",

"<NSLayoutConstraint:0x7faba2d51780 H:[MPKnockoutButton:0x7faba2e6d750]-(34)-[MPDetailSlider:0x7faba2dc6440](LTR)>",

"<NSLayoutConstraint:0x7faba2d5b7f0 H:[MPDetailSlider:0x7faba2dc6440]-(34)-[UIView:0x7faba2dc4060](LTR)>",

"<NSLayoutConstraint:0x7faba2dc5da0 UIView:0x7faba2dc4060.right == _UIBackdropView:0x7faba2dbfdc0.right>",

"<NSLayoutConstraint:0x7faba2dc58d0 H:|-(0)-[_UIBackdropView:0x7faba2dbfdc0]   (Names: '|':MPVideoPlaybackOverlayView:0x7faba2dbf6a0 )>",

"<NSLayoutConstraint:0x7faba2dc5950 H:[_UIBackdropView:0x7faba2dbfdc0]-(0)-|   (Names: '|':MPVideoPlaybackOverlayView:0x7faba2dbf6a0 )>",

"<NSLayoutConstraint:0x7faba2df9b10 H:[MPVideoPlaybackOverlayView:0x7faba2dbf6a0(0)]>",

"<NSAutoresizingMaskLayoutConstraint:0x7faba2dfbfa0 h=-&- v=-&- _UIBackdropContentView:0x7faba2dc38c0.midX == _UIBackdropView:0x7faba2dbfdc0.midX>",

"<NSAutoresizingMaskLayoutConstraint:0x7faba2dfbff0 h=-&- v=-&- _UIBackdropContentView:0x7faba2dc38c0.width == _UIBackdropView:0x7faba2dbfdc0.width>"
)

有什么想法吗?

我自己刚遇到这个问题

我注意到,在我访问之前,即使屏幕上没有
MKMoviePlayerController
视图,约束警告也会出现

这导致我删除了对缩略图生成API的调用
requestThumbnailImagesAtTimes:timeOption:
cancelAllThumbnailImageRequests

使用另一种检索缩略图的方法后,警告立即停止

虽然我正在加载本地URL,而不是流式传输,但我想流式传输机制正在尝试加载某个地方的缩略图,并导致我们看到的问题


我还没有注意到这个问题的任何书面解决方案或答案,所以我希望我的轶事证据能有所帮助。

这似乎在iOS 8.1中得到了解决。升级后错误消失了

但是,我不得不稍微修改我的代码:

movieController = [[MPMoviePlayerController alloc]
                    initWithContentURL:[NSURL URLWithString:playlistUrl]];

movieController.movieSourceType = MPMovieSourceTypeStreaming;

[movieController.view setTranslatesAutoresizingMaskIntoConstraints:NO];
[playerView addSubview:movieController.view];

id views = @{ @"player": movieController.view };

[playerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[player]|"
                                                                       options:0
                                                                       metrics:nil
                                                                         views:views]];

[playerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[player]|"
                                                                       options:0
                                                                       metrics:nil
                                                                         views:views]];
[movieController play];
给懒惰的人

当我想直接使用
movieController.view.frame
时,我只需调用

[movieController.view setTranslatesAutoresizingMaskIntoConstraints:YES];
以前

[movieController prepareToPlay];
[self.view addSubview:movieController.view];

不要弄乱约束。

谢谢,西蒙,这为我节省了很多时间!
[movieController prepareToPlay];
[self.view addSubview:movieController.view];