美文网首页
iOS wkwebview 企业app更新

iOS wkwebview 企业app更新

作者: 王家小雷 | 来源:发表于2019-06-24 15:27 被阅读0次
    • (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {

    ifdef BGY_FLAG

    if ([navigationAction.request.URL.absoluteString containsString:@"?no_intercept"]) {
        [[UIApplication sharedApplication] openURL:navigationAction.request.URL];
    }
    else if ([navigationAction.request.URL.absoluteString hasPrefix:@"weixin"])
    {
        [[UIApplication sharedApplication] openURL:navigationAction.request.URL];
    }
    NSURL *url = navigationAction.request.URL;
    UIApplication *app = [UIApplication sharedApplication];
    // 打开appstore
    if ([navigationAction.request.URL.absoluteString containsString:@"itunes.apple.com"]) {
        if ([app canOpenURL:url]) {
            [app openURL:url];
            decisionHandler(WKNavigationActionPolicyCancel);
            return;
        }
    }
    //下载企业包
    if ([navigationAction.request.URL.absoluteString containsString:@"itms-services://"]) {
        if (@available(iOS 10.0, *)) {
            [app openURL:url options:@{} completionHandler:^(BOOL success) {
                
            }];
        } else {
            [app openURL:url];
        }
        decisionHandler(WKNavigationActionPolicyCancel);
        return;
    }
    
    decisionHandler(WKNavigationActionPolicyAllow);
    

    endif

    }

    相关文章

      网友评论

          本文标题:iOS wkwebview 企业app更新

          本文链接:https://www.haomeiwen.com/subject/eikoqctx.html