iOS:fix NSTimer invalidate in main queue

This commit is contained in:
pengfei.zhou 2020-05-08 16:51:19 +08:00 committed by osborn
parent 9863c8bbf8
commit c51fc83537

View File

@ -144,8 +144,10 @@ - (void)initJSExecutor {
__strong typeof(_self) self = _self;
NSTimer *timer = [self.timers valueForKey:timerId];
if (timer) {
[timer invalidate];
[self.timers removeObjectForKey:timerId];
dispatch_async(dispatch_get_main_queue(), ^{
[timer invalidate];
});
}
}];