From c51fc835375a85dffb9942a05939540134497354 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 8 May 2020 16:51:19 +0800 Subject: [PATCH] iOS:fix NSTimer invalidate in main queue --- doric-iOS/Pod/Classes/Engine/DoricJSEngine.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m b/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m index c874b683..ec692a6c 100644 --- a/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m +++ b/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m @@ -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]; + }); } }];