'MPMoviePlayerController' 已弃用:首先在 iOS 9.0 中弃用

'MPMoviePlayerController' is deprecated: first deprecated in iOS 9.0

已经有人在 swift
中回答了这个问题 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];
    }];  

希望对遇到此问题的人有所帮助。