KVO bug when ScrollView is dealloced
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
Same issue...
To force removing the observer, you can add this to your View Controller subclass:
- (void)dealloc {
self.tableView.showsInfiniteScrolling = NO;
self.tableView.showsPullToRefresh = NO;
}
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