Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVO are not deleted when the tableview is delete #6

Open
jerometonnelier opened this issue Jul 29, 2014 · 5 comments
Open

KVO are not deleted when the tableview is delete #6

jerometonnelier opened this issue Jul 29, 2014 · 5 comments

Comments

@jerometonnelier
Copy link

2014-07-29 16:20:41.977 RG[15786:60b] An instance 0xe0b6600 of class UITableView 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 0xc276520> (
<NSKeyValueObservance 0xc276600: Observer: 0xe0b6600, Key path: contentOffset, Options: <New: YES, Old: YES, Prior: NO> Context: 0x253784, Property: 0xc276500>
)

@orenk86
Copy link

orenk86 commented Aug 13, 2014

I'm also experiencing this problem.
Basically an observer is getting set for the floating header (obviously), but doesn't get removed before the tableview is deallocated from the memory.
I tried fixing this by implementing a "dealloc" method, or a "remove observer" method inside the floating header's class and having my View Controller call it inside its own "dealloc" or "viewWillDissapear" methods.
Sadly, no luck. In all scenarios, either the problem persists, or the app crashes.

Any updates on this?

@paulius005
Copy link

+1 I am also experiencing this problem

@paulius005
Copy link

viewWillDisappear is called before memory teardown, so that may be the place to remove whatever is not being removed in the UIViewController.

@paulius005
Copy link

[self addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew context:IBFloatingHeaderViewContext];

This seems to be the observer that should be removed

@paulius005
Copy link

Figured it out.

Need this:
-(void)removeContentOffsetObserver { [self removeObserver:self forKeyPath:@"contentOffset" context:IBFloatingHeaderViewContext]; }

Will fork and submit pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants