0

I have an AVPlayer that runs fine on iOS 4.3 and above. When I try to get it to work on iOS 4.2, this happens after dealloc:

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>

This would be ok, but right after, is this:

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

I checked to make sure all of my observers are removed properly, and I'm fairly certain they are. The only difference in my code from 4.3 to 4.2 is this: HTTP Live Streaming with AVPlayer in iOS 4.0?

This looks to me like its something AVPlayer is handling internally, and is trying to remove the observer after it's already been released. Am I going crazy or is this just a bug with 4.2?

Community
  • 1
  • 1
Chris C
  • 3,221
  • 1
  • 27
  • 31

1 Answers1

0

Double check your code. It looks as though an observer is still registered for:

currentItem.nonForcedSubtitleDisplayEnabled

You can set a breakpoint as advised in XCode 4 and inspect the object in memory.

Sam
  • 2,579
  • 17
  • 27
  • I never set an observer for that value, though. The only KVO I'm doing is for the "status" property of player.currentItem, and I'm removing that observer in dealloc. – Chris C Mar 29 '12 at 22:05
  • Please post your dealloc method! – Sam Mar 30 '12 at 15:44