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
Crash demo code:
#import "ViewController.h" #import <Foundation/Foundation.h> @import EasySwiftHook; @interface ViewController () @property (nonatomic, strong) dispatch_source_t timer; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self startTimer]; } #pragma mark - timer - (void)startTimer { self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); dispatch_source_set_timer(self.timer, dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), 1 * NSEC_PER_SEC, 0); dispatch_source_set_event_handler(self.timer, ^{ NSLog(@"aaa"); }); dispatch_resume(self.timer); NSError *error = nil; [self.timer sh_hookDeallocAfterAndReturnError:&error closure:^{ NSLog(@"dealloc"); }]; NSAssert(error == nil, @"!!!"); } @end
Crash screenshot:
The text was updated successfully, but these errors were encountered:
Actually, this is a bug from KVO. The code below also crashes.
#import "ViewController.h" #import <Foundation/Foundation.h> @interface ViewController () @property (nonatomic, strong) dispatch_source_t timer; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self startTimer]; } #pragma mark - timer - (void)startTimer { self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); dispatch_source_set_timer(self.timer, dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), 1 * NSEC_PER_SEC, 0); dispatch_source_set_event_handler(self.timer, ^{ NSLog(@"aaa"); }); dispatch_resume(self.timer); [self.timer addObserver:self forKeyPath:@"hash" options:NSKeyValueObservingOptionNew context:NULL]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context { NSLog(@"%@", keyPath); } @end
Sorry, something went wrong.
No branches or pull requests
Crash demo code:
Crash screenshot:
The text was updated successfully, but these errors were encountered: