shareResultBlock 为回调方法。
当回调方法中有 [_webView stringByEvaluatingJavaScriptFromString:jsStr];
// [self performSelectorOnMainThread:@selector(test) withObject:nil waitUntilDone:YES];
self.shareResultBlock(@"0000",callBackStr);
- (void)test{
self.shareResultBlock(@"0000",callBackStr);
}
执行stringByEvaluatingJavaScriptFromString:jsStr]; 会阻塞主线程 导致卡死,若用
[self performSelectorOnMainThread:@selector(test) withObject:nil waitUntilDone:YES]; YES表示需要阻塞主线程,这里用NO,也可以得到相同的结果