samvermette/SVPullToRefresh

fix cash on Observing

captain-black opened this issue · 2 comments

    if (self.infiniteScrollingView.isObserving) {
        [self removeObserver:self.infiniteScrollingView forKeyPath:@"contentOffset"];
        [self removeObserver:self.infiniteScrollingView forKeyPath:@"contentSize"];
        [self.infiniteScrollingView resetScrollViewContentInset];
        self.infiniteScrollingView.isObserving = NO;
    }

[self.infiniteScrollingView resetScrollViewContentInset]; will make scrolling and trigger this method again.

you should do:
if (self.infiniteScrollingView.isObserving) {
self.infiniteScrollingView.isObserving = NO;
[self removeObserver:self.infiniteScrollingView forKeyPath:@"contentOffset"];
[self removeObserver:self.infiniteScrollingView forKeyPath:@"contentSize"];
[self.infiniteScrollingView resetScrollViewContentInset];
}

This kind of BUG is also in the other method, fix them like above

you are welcome to pull a request. This project has stopped updating for a long time. You can fix it in your branch.