iPhone SDK 4: weird compilation error, MPMoviePlayerController
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:
Undefined symbols:
"_开发者_C百科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?
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
You added the MediaPlayer.framework framework?
精彩评论