AXWebViewController is a webViewController to browse web content inside applications. It’s a lightweight controller on iOS platform based on WKWebView (UIWebView would be the base Kit under iOS 8.0). It added navigation tool bar to refresh, go back, go forward and so on. It support the navigation style on WeChat. It is a simple-using and convenient web view controller using inside applications.
65
问题所在地方,AXWebViewController.m文件 755行 以下是我处理方法:
(void)webView:(WKWebView )webView runJavaScriptAlertPanelWithMessage:(NSString )message initiatedByFrame:(WKFrameInfo )frame completionHandler:(void (^)(void))completionHandler { // Get host name of url. NSString host = webView.URL.host; // Init the alert view controller. // UIAlertController alert = [UIAlertController alertControllerWithTitle:host?:@"来自网页的消息" message:message preferredStyle: UIAlertControllerStyleAlert]; // Init the cancel action. // UIAlertAction cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:NULL]; // Init the ok action. // UIAlertAction okAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction action) { // [alert dismissViewControllerAnimated:YES completion:NULL]; // completionHandler(); // }]; // Add actions. // [alert addAction:cancelAction]; // [alert addAction:okAction];
/* 使用您上方的写法,弹框弹不出来还会线程卡死,多点几次弹alert的方法会卡死项目 / UIAlertController alertController = [UIAlertController alertControllerWithTitle:@"提示" message:message?:@"" preferredStyle:UIAlertControllerStyleAlert]; [alertController addAction:([UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction _Nonnull action) { completionHandler(); }])]; [self presentViewController:alertController animated:YES completion:nil]; }