2012-08-02 76 views
0

這裏是我的執行文件:目標C播放視頻

-(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> 
) 

它加載播放器視圖和照片直接關閉subplayerview。

有什麼建議嗎?

回答

0

閱讀錯誤。在您的代碼(或蘋果)的某處,有一個KVO Observer未被刪除。我不認爲你可以設置playercontroller爲零,並期望它保留自己。嘗試堅持引用它,併成爲它的代表。

+0

我得到的smae錯誤沒有playercontroller =零; – 2012-08-03 00:37:53