gpt4 book ai didi

ios8 - MPMoviePlayerController 布局约束问题

转载 作者:行者123 更新时间:2023-12-04 07:21:52 28 4
gpt4 key购买 nike

我正在将应用程序移植到 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>"
)

这是代码:
movieController = [[MPMoviePlayerController alloc]
initWithContentURL:[NSURL URLWithString:playlistUrl]];

movieController.movieSourceType = MPMovieSourceTypeStreaming;
[movieController.view setFrame:[self.playerView bounds]];

[self.playerView addSubview:movieController.view];
[movieController play];

有什么想法吗?

最佳答案

这似乎已在 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];

关于ios8 - MPMoviePlayerController 布局约束问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26087428/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com