关闭 MPMoviePlayerViewController 后出现空白电影播放器

After Dismissing MPMoviePlayerViewController a Blank Movie Player Appears

它似乎在 mpmovieplayerviewcontroller 启动其电影播放器​​之前启动了电影播放器​​。

之后出现的空白电影播放器​​无法通过单击完成按钮关闭。

代码如下:

class VideoViewController: UIViewController {

    var movieViewController:MPMoviePlayerViewController?

    override func viewDidLoad() {
        let path = NSBundle.mainBundle().pathForResource("Open Range", ofType: "mp4")
        let url = NSURL.fileURLWithPath(path!);
        movieViewController = MPMoviePlayerViewController(contentURL: url)
        NSNotificationCenter.defaultCenter().addObserver(self,
            selector:"doneButtonClick:",
            name:MPMoviePlayerPlaybackDidFinishNotification,
            object:nil)
        NSNotificationCenter.defaultCenter().addObserver(self,
            selector:"doneButtonClick:",
            name:MPMoviePlayerDidExitFullscreenNotification,
            object:nil)
    }
    override func viewDidAppear(animated: Bool) {
        self.presentMoviePlayerViewControllerAnimated(movieViewController)
    }
    @objc func doneButtonClick(notification: NSNotification){
        self.movieViewController?.moviePlayer.stop()
        self.dismissMoviePlayerViewControllerAnimated()
    }
}

已解决。问题是我正在转向一个单独的视图控制器,其中包含 MPMoviePlayerViewController。当我将 MPMoviePlayerViewController 移动到我想从中启动电影的视图控制器时,它在调用 self.dismissMoviePlayerViewControllerAnimated()

后 returns 到所需的视图