Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
* master:
  修复 KVO cntext 被移除的问题
  • Loading branch information
[email protected] committed Nov 23, 2017
2 parents bee9f81 + 56f92b3 commit 2c1bcb7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Classes/TableUtils/IMYAOPTableViewUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,19 @@ - (void)bindingTableView:(UITableView *)tableView aopClass:(Class)aopClass
for (id observance in observanceArray) {
NSString *keyPath = [observance valueForKeyPath:@"_property._keyPath"];
id observer = [observance valueForKey:@"_observer"];
id context = nil;
if (observer && keyPath) {
NSKeyValueObservingOptions options = 0;
@try {
context = [observance valueForKey:@"_context"];
options = [[observance valueForKey:@"_options"] unsignedIntegerValue];
} @catch (NSException *exception) {
IMYLog(@"%@", exception.debugDescription);
}
if (options == 0) {
options = (NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew);
}
[tableView addObserver:observer forKeyPath:keyPath options:options context:nil];
[tableView addObserver:observer forKeyPath:keyPath options:options context:(void *)context];
}
}
}
Expand Down

0 comments on commit 2c1bcb7

Please sign in to comment.