当我尝试从我的iPhone(位于documentsDirectory)中播放视频时,使用iOS 5时出现以下错误,而iOS 4.3正常工作时:
AVPlayerItem类的实例0x168da0已取消分配,而键值观察者仍在其中注册.观察信息被泄露,甚至可能被错误地附加到其他物体上.在NSKVODeallocateBreak上设置断点以在调试器中停止.这是当前的观察信息:(上下文:0x0,属性:0x10b570>上下文:0x0,属性:0x117ab0>
这是代码提取:
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:[appDelegate.mediaManager loadVideo:[element valueForAttributeNamed:@"value"]]];
//create a NSNotificationCenter which call moviePlaybackComplete function when video playback finished
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];
//display the moviePlayer view
[self.view addSubview:moviePlayerController.view];
moviePlayerController.fullscreen = YES;
[moviePlayerController play];
Run Code Online (Sandbox Code Playgroud)