这是我的实现文件:
-(IBAction)playvideo {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"Intro" ofType:@"mp4"]];
MPMoviePlayerViewController *playercontroller = [[MPMoviePlayerViewController alloc]
initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated:playercontroller];
playercontroller.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[playercontroller.moviePlayer play];
playercontroller = nil;
}
这是一个奇怪的错误:
2012-08-03 01:48:40.085 Assaultive[5569:16a03] An instance 0x9b5ad50 of class AVPlayerItem was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x8549f10> (
<NSKeyValueObservance 0x9b5cde0: Observer: 0x9b58690, Key path: nonForcedSubtitleDisplayEnabled, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x9b5ce60>
<NSKeyValueObservance 0x9b5cfa0: Observer: 0x9b54b90, Key path: presentationSize, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x9957780>
)
它加载播放器视图并直接关闭子播放器视图。
有什么建议么?