我有一个viewController包含以下方法:
- (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];
}
Run Code Online (Sandbox Code Playgroud)
由于错误,我无法编译代码:
未定义的符号:
"_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
Run Code Online (Sandbox Code Playgroud)
这条消息对我没有意义.
我打算将此方法用作视图控制器的一部分.我是否必须为播放器创建单独的视图控制器,或者情况并非如此?
我在创建这个项目时使用了SDK 3.1.2,但是根据新的API规则完全重写了playMovie方法.当前的SDK版本是4.0.1
iphone ×1