NSString* methodNameStr=[NSString stringWithFormat:@"device_callback(%d,\"%@\")",[@"6001" isEqualToString:@"6001"]?-1:-2,[@"6001" isEqualToString:@"6001"]?@"支付取消":@"支付失敗"];
如果在通知方法里直接調(diào)用
[weakSelf.webView stringByEvaluatingJavaScriptFromString:methodNameStr];
會彈出alert? 但是點(diǎn)擊不了
所以不能這樣寫
NSString *jsMyAlert =[NSString stringWithFormat:@"setTimeout(function(){%@;},1)",methodNameStr];
[weakSelf.webView stringByEvaluatingJavaScriptFromString:jsMyAlert];