當我嘗試從我的iPhone上播放的視頻(位於documentsDirectory),我得到使用的是iOS 5,而這是工作的罰款與iOS 4.3以下錯誤:的iOS 5 AVPlayerItem的實例被釋放
的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];
NSNotificationCenter!= KVO。你正在混合兩種完全不同的技術。 – steipete
他問的是'MPMoviePlayerPlaybackDidFinishNotification'那不是KVO –
willWillDisappear?你的意思是viewWillDisappear? :) – Sabobin