SVPullToRefresh icon indicating copy to clipboard operation
SVPullToRefresh copied to clipboard

KVO bug when ScrollView is dealloced

Open jonasman opened this issue 12 years ago • 3 comments

When my UITableView is dealloced i get this error:

An instance 0x17adda00 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 0x18f47240> ( <NSKeyValueObservance 0x18f47070: Observer: 0x18f46190, Key path: contentSize, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x18be8b40> )

The observer is not being removed because there is no dealloc method

jonasman avatar Aug 13 '13 06:08 jonasman

Same issue...

MaximKeegan avatar Dec 24 '14 12:12 MaximKeegan

To force removing the observer, you can add this to your View Controller subclass:

- (void)dealloc {
    self.tableView.showsInfiniteScrolling = NO;
    self.tableView.showsPullToRefresh = NO;
}

marcelofabri avatar Jan 03 '15 18:01 marcelofabri

this was happening to me because I was conditionally calling addInfiniteScrollingWithActionHandler but always called showsInfiniteScrolling. In cases where addInfiniteScrollingWithActionHandler was not called it would cause a crash

aryaxt avatar Jul 08 '16 16:07 aryaxt