gpt4 book ai didi

ios - - (JSValue *)callWithArguments :(NSArray *)arguments crashed in ios7. 0.4

转载 作者:行者123 更新时间:2023-11-29 10:33:19 31 4
gpt4 key购买 nike

存在一个属性@property (nonatomic, strong) JSContext *context;并且我在 webviews 的委托(delegate)方法中设置了 jscontext。

    - (void)webViewDidFinishLoad:(UIWebView *)webView
{
[self.indicatorView stopAnimating];
self.webView.hidden = NO;
__weak typeof(self) weakSelf = self;
self.context = [webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
self.context[@"closeWebview"] = ^() {
weakSelf.dismissViewBlock();
};
}

定位成功后会调用下面的方法:

    - (void)sendUserInfoDicToJSLocationSuccess:(BOOL)isSuccess
{
NSDictionary *userInfoDic = [self getResponseDicLocationSuccess:isSuccess];
NSString *responseStr = [userInfoDic jsonString];
if (responseStr.length <= 0) {
NSAssert(NO, nil);
return;
}
// [NSThread sleepForTimeInterval:1];
dispatch_async(dispatch_get_main_queue(), ^{
if (self.context && responseStr.length > 0) {
JSValue *callBackValue = self.context[@"mobileCallback"];
if (callBackValue) {
[callBackValue callWithArguments:@[responseStr]];
}
}
});
}

如果我使用时间延迟,效果很好。否则它会在 webcore 线程中崩溃。错误信息如下

WebCore`void WebCore::StyleResolver::applyMatchedProperties<(WebCore::StyleResolver::StyleApplicationPass)1>(WebCore::StyleResolver::MatchResult const&, bool, int, int, bool):
0x8f3ff40: pushl %ebp
0x8f3ff41: movl %esp, %ebp
0x8f3ff43: pushl %ebx
0x8f3ff44: pushl %edi
0x8f3ff45: pushl %esi
0x8f3ff46: subl $0x2c, %esp
0x8f3ff49: movl 0x14(%ebp), %edi
0x8f3ff4c: cmpl $-0x1, %edi
0x8f3ff4f: je 0x8f40072

;

void WebCore::StyleResolver::applyMatchedProperties<(WebCore::StyleResolver::StyleApplicationPass)1>(WebCore::StyleResolver::MatchResult const&, bool, int,

int, bool) + 306
0x8f3ff55: movl 0x18(%ebp), %esi
0x8f3ff58: movl 0xc(%ebp), %ebx
0x8f3ff5b: movl 0x8(%ebp), %edx
0x8f3ff5e: movl 0x130(%edx), %eax
0x8f3ff64: movzwl 0x2c(%eax), %eax

最佳答案

我已经解决了这个问题。

dispatch_async(dispatch_get_main_queue(), ^{
if (self.context && responseStr.length > 0) {
JSValue *callBackValue = self.context[@"mobileCallback"];
[self.context[@"setTimeout"] callWithArguments:@[callBackValue,@0, responseStr]];
}
});

关于ios - - (JSValue *)callWithArguments :(NSArray *)arguments crashed in ios7. 0.4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28406952/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com