<分区>
<分区>
已经有人快速回答了这个问题
MPMoviePlayerController' is deprecated in swift我想要这个在 Objective-C 中。
我收到这个警告
'MPMoviePlayerController' is deprecated: first deprecated in iOS 9.0
这是我的代码:
MPMoviePlayerController* _moviePlayer;
_moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:contentURL];
_moviePlayer.shouldAutoplay = YES;
[self.view addSubview:_moviePlayer.view];
[_moviePlayer setFullscreen:YES animated:YES];
最佳答案
在@Larme 的帮助下,我解决了我的问题。
1)我添加了两个框架
#import <AVKit/AVKit.h>
#import <AVFoundation/AVFoundation.h>
2) 我将我的代码替换为
AVPlayerViewController * _moviePlayer1 = [[AVPlayerViewController alloc] init];
_moviePlayer1.player = [AVPlayer playerWithURL:_img.contentURL];
[self presentViewController:_moviePlayer1 animated:YES completion:^{
[_moviePlayer1.player play];
}];
我希望它能帮助遇到这个问题的人。
关于ios - 'MPMoviePlayerController' 已弃用 : first deprecated in iOS 9. 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43782248/