shareResultBlock 為回調方法顾复。
當回調方法中有 [_webView stringByEvaluatingJavaScriptFromString:jsStr];
// [self performSelectorOnMainThread:@selector(test) withObject:nil waitUntilDone:YES];
self.shareResultBlock(@"0000",callBackStr);
- (void)test{
self.shareResultBlock(@"0000",callBackStr);
}
執(zhí)行stringByEvaluatingJavaScriptFromString:jsStr]; 會阻塞主線程 導致卡死,若用
[self performSelectorOnMainThread:@selector(test) withObject:nil waitUntilDone:YES]; YES表示需要阻塞主線程辕狰,這里用NO冕香,也可以得到相同的結果