Open trainerleipzig opened 10 years ago
add this method to AAPullToRefresh.m
-(void) dealloc
{
@try
{
[self.scrollView removeObserver:self forKeyPath:@"contentOffset"];
[self.scrollView removeObserver:self forKeyPath:@"contentSize"];
[self.scrollView removeObserver:self forKeyPath:@"frame"];
}
@catch (NSException *exception)
{
}
}
Adding -(void) dealloc {..}
did not help me with this issue.
After I switched @property (nonatomic, weak) UIScrollView *scrollView;
to strong
in AAPullToRefresh.h error is gone.
Probably same issue #8.
@xzenon : can you tell me why ? :+1:
You don't have to add - (void)dealloc
to AAPullToRefresh.m, just add:
- (void)dealloc {
pullToRefresh.showPullToRefresh = NO;
}
to your ViewController. it's work for me.
@arielpollack Thanks for your answer man. I was stuck with the same issue for past 3 days.
I have a navigation controller based application. At the first view there exist a button who push another ViewController or TableViewController to the navigation controller stack. This ViewController / TableViewController use the AAPullToRefresh. If I go back to the main root controller, I get the follow error message:
"An instance 0x99fca00 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 0x8ba4790> ( <NSKeyValueObservance 0x8bcffe0: Observer: 0x8bcc2d0, Key path: contentOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x8cd3d80> <NSKeyValueObservance 0x8bd0040: Observer: 0x8bcc2d0, Key path: contentSize, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x8cd5970> <NSKeyValueObservance 0x8bd00e0: Observer: 0x8bcc2d0, Key path: frame, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x8cd5fc0> )"
If I need a ViewController with ScrollView it's the same. Only the word "UITableView" replaced by "UIScrollView". The message replicate with every new push of the controller. What can I do?