我正在关注此主题的上一个问题,试图在我的应用中播放视频。我已将名为iobserve1.mov的视频复制到资源文件夹中,并在我的h文件中导入MediaPlayer / MediaPlayer.h。我收到以下错误:
Apple Mach-O链接器错误 “_OBJC_CLASS _ $ _ MPMoviePlayerController”,引自:
和
Apple Mach-O链接器错误 链接器命令失败,退出代码为1(使用-v查看调用)
@interface ObViewControllerIObserveMovie ()
@property (weak, nonatomic) IBOutlet UIView *movieView; // this should point to a view where the movie will play
@end
@implementation ObViewControllerIObserveMovie
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"iobserve1" ofType:@"mov"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];
player.view.frame = CGRectMake(184, 200, 400, 300);
[self.view addSubview:player.view];
[player play];
}
非常感谢任何帮助。
答案 0 :(得分:1)
您是否已将MediaPlayer框架添加到项目中?它包含MPMediaPlayerController类