【问题标题】:iOS - Use AVPlayerViewController in AVKit obj-ciOS - 在 AVKit obj-c 中使用 AVPlayerViewController
【发布时间】:2016-12-08 23:26:29
【问题描述】:

我正在尝试更新这个已弃用的方法: 'presentMoviePlayerViewControllerAnimated' 但是我无法导入 AVKit 并使用 AVPlayerViewContoller。我的 Xcode 似乎没有以某种方式看到这个框架。

这是我的代码:

MatchDetailsVC.m

   -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath (NSIndexPath *)indexPath {
YoutubeVideoModel* video = [_videos objectAtIndex:indexPath.row];

XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithVideoIdentifier:video.videoID];
   =>[self presentMoviePlayerViewControllerAnimated:videoPlayerViewController];

无法访问 AVKit 文件: using CM + click

MatchDetalisVC.m 更新

[self presentViewController:videoPlayerViewController animated:YES completion:nil];

用这个改变了最后一行。没有错误。看来我也不必在我的 ViewController 中 #import AVKit。但它是正确的吗?

【问题讨论】:

  • 你的#imports 是什么样的?你得到什么错误?
  • 找不到文件。我试过“AVKit.h”、“AVPlayerViewController.h”。
  • 试试#import <AVKit/AVKit.h>
  • 现在没有错误,但是我无法通过任何 AVKit.h 文件。不断得到问号。使用哪种方法来重建我的 presentMovie 通话?
  • 我认为您需要显示更多代码和问号。

标签: ios objective-c avplayer avplayerviewcontroller avkit


【解决方案1】:

添加了这一行,正常工作

#import <AVKit/AVKit.h>

【讨论】:

    猜你喜欢
    • 2015-10-20
    • 2016-12-16
    • 2014-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-20
    • 2012-05-22
    相关资源
    最近更新 更多