【问题标题】:Unrecognized selector when creating AVPlayer创建 AVPlayer 时无法识别的选择器
【发布时间】:2016-01-22 22:15:17
【问题描述】:

我在尝试从外部源创建 AVPlayer 时收到 unrecognized selector 错误。据我所知,我完全遵循 Apple 的指导方针。

我想做的只是:

#import <AVKit/AVKit.h> // Not sure if these are both necessary but they can't hurt
#import <AVFoundation/AVFoundation.h>

NSURL *videoURL = [NSURL URLWithString:@"https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];
AVPlayer *player = [AVPlayer playerWithURL:videoURL];

我在最后一行得到这个错误:

+[AVPlayer playerWithURL:]: unrecognized selector sent to class 0x1000f30c8

【问题讨论】:

    标签: ios objective-c avfoundation avplayer avkit


    【解决方案1】:

    您的代码没有任何问题。它在模拟器和未越狱的 iOS 9 iPhone 上都能正确编译和执行。

    我建议在模拟器和/或其他设备上尝试一下。简单地说,如果 AVPlayer 没有实现 playerWithURL: ,那么你就没有在工作的开发环境中操作。越狱确实是唯一想到的事情。如果不是这种情况,也许重新安装 iOS。你看到的不正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-01
      • 2018-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多