iPhone SDK 4:奇怪的编译错误,MPMoviePlayerController [英] iPhone SDK 4: weird compilation error, MPMoviePlayerController

查看:39
本文介绍了iPhone SDK 4:奇怪的编译错误,MPMoviePlayerController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下方法的viewController:

I have a viewController containing the following method:

- (IBAction) playMovie {
    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"m4v"]];

    MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:)
                                       name:MPMoviePlayerPlaybackDidFinishNotification
                                       object:moviePlayer];

    moviePlayer.controlStyle = MPMovieControlStyleNone;
    moviePlayer.shouldAutoplay = YES;

    [self.view addSubview:moviePlayer.view];
    [moviePlayer setFullscreen:YES animated:YES];
}

由于错误,我无法编译代码:

I can't compile the code because of the error:

未定义符号:

  "_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
      _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in AnotherViewController.o
     (maybe you meant: _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr)
  "_OBJC_CLASS_$_MPMoviePlayerController", referenced from:
      objc-class-ref-to-MPMoviePlayerController in AnotherViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

此消息对我来说毫无意义.

This message doesn't make sense to me.

我打算将此方法用作视图控制器的一部分.我是否需要为播放器创建一个单独的视图控制器,不是吗?

I was intended to use this method as a part of a view controller. Do I have to create a separate view controller for the player or it's not the case?

创建此项目时,我使用的是SDK 3.1.2,但playMovie方法已根据新的API规则完全重写.当前的SDK版本是4.0.1

I worked with SDK 3.1.2 when I created this project but the playMovie method was completely rewritten according to new API rules. The current SDK version is 4.0.1

推荐答案

您添加了MediaPlayer.framework框架吗?

You added the MediaPlayer.framework framework?

这篇关于iPhone SDK 4:奇怪的编译错误,MPMoviePlayerController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆