2012-03-29 51 views
0

我有一個在iOS 4.3及更高版本上運行良好的AVPlayer。當我設法得到它在iOS 4.2工作,出現這種情況的dealloc後:在內部KVO之前發佈的AVPlayer被刪除?

An instance 0x69c3b0 of class AVPlayer 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 0x42626d0> (
    <NSKeyValueObservance 0x69f480: Observer: 0x666b20, Key path: currentItem.nonForcedSubtitleDisplayEnabled, Options: <New: NO, Old: NO, Prior: NO> Context: 0x3ea5b558, Property: 0x69f4c0> 

這將是確定的,但之後,是這樣的:

-[NSKVONotifying_AVPlayer removeObserver:forKeyPath:]: message sent to deallocated instance 0x69c3b0 

我檢查,以確保所有的我的觀察員被正確地移除,我相當確定他們是。我的代碼從4.3到4.2的唯一區別是這樣的: HTTP Live Streaming with AVPlayer in iOS 4.0?

這看起來像我的AVPlayer內部處理的東西,並試圖刪除它已被釋放後的觀察員。我會瘋了還是這只是一個4.2的錯誤?

+0

這很可能是AVPlayer中的一個錯誤。在MPMoviePlayerController中也看到相同的內容。時間爲rdar://。 (仍然在iOS 5.1) – steipete 2012-04-01 05:44:17

回答

0

仔細檢查您的代碼。看起來好像觀察員仍在登記:

currentItem.nonForcedSubtitleDisplayEnabled

你可以設置一個斷點爲建議中的XCode 4,檢查對象在內存中。

+0

雖然我從來沒有爲該值設置觀察者。我正在做的唯一的KVO是player.currentItem的「status」屬性,並且我正在刪除dealloc中的觀察者。 – 2012-03-29 22:05:10

+0

請發表您的dealloc方法! – Sam 2012-03-30 15:44:09

相關問題