3
我有含有下列方法的viewController:iPhone SDK 4:怪異編譯錯誤,的MPMoviePlayerController
- (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];
}
我不能編譯,因爲錯誤的代碼:
未定義符號:
"_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
這條消息對我沒有意義。
我打算使用這種方法作爲視圖控制器的一部分。我是否必須爲玩家創建單獨的視圖控制器,或者情況並非如此?
我在創建此項目時使用SDK 3.1.2,但playMovie方法根據新的API規則完全重寫。當前的SDK版本是4.0.1