We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如题: NSKeyValueObservingOptions opts = NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew; [self.player addObserver:self forKeyPath:@"rate" options:opts context:nil];
NSKeyValueObservingOptions opts = NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew; [self.player addObserver:self forKeyPath:@"rate" options:opts context:nil];
添加后查看player.observationInfo 是null空的,其他的类型如果添加了NSKeyValueObservingOptionInitial值,还没试是否会添加失败。
在KVO防护里判断下如果有intial值的不防护,问题可以解决 - (void)hookAddObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context{ if ([self ignoreKVOInstanceClass:observer] || (options & NSKeyValueObservingOptionInitial)) { [self hookAddObserver:observer forKeyPath:keyPath options:options context:context]; return; }
- (void)hookAddObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context{ if ([self ignoreKVOInstanceClass:observer] || (options & NSKeyValueObservingOptionInitial)) { [self hookAddObserver:observer forKeyPath:keyPath options:options context:context]; return; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
如题:
NSKeyValueObservingOptions opts = NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew; [self.player addObserver:self forKeyPath:@"rate" options:opts context:nil];
添加后查看player.observationInfo 是null空的,其他的类型如果添加了NSKeyValueObservingOptionInitial值,还没试是否会添加失败。
在KVO防护里判断下如果有intial值的不防护,问题可以解决
- (void)hookAddObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context{ if ([self ignoreKVOInstanceClass:observer] || (options & NSKeyValueObservingOptionInitial)) { [self hookAddObserver:observer forKeyPath:keyPath options:options context:context]; return; }
The text was updated successfully, but these errors were encountered: