iOS:add protection for SIGSEGV

This commit is contained in:
pengfei.zhou
2020-04-20 11:03:48 +08:00
committed by osborn
parent 4ef508d3a7
commit de9b96c490
8 changed files with 59 additions and 15 deletions

View File

@@ -52,6 +52,22 @@ - (DoricRegistry *)registry {
return ret;
}
- (DoricAsyncResult *)invokeDoricMethod:(NSString *)method argumentsArray:(NSArray *)args {
DoricAsyncResult *ret = [[DoricAsyncResult alloc] init];
__weak typeof(self) _self = self;
dispatch_async(self.jsExecutor.jsQueue, ^() {
__strong typeof(_self) self = _self;
if (!self) return;
@try {
JSValue *jsValue = [self.jsExecutor invokeDoricMethod:method argumentsArray:args];
[ret setupResult:jsValue];
} @catch (NSException *exception) {
[ret setupError:exception];
}
});
return ret;
}
- (DoricAsyncResult<JSValue *> *)invokeDoricMethod:(NSString *)method arguments:(va_list)args {
DoricAsyncResult *ret = [[DoricAsyncResult alloc] init];
NSMutableArray *array = [[NSMutableArray alloc] init];