iOS UIWebView 调用支付宝或微信支付

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType

{

    NSString* reqUrl = request.URL.absoluteString;

    if([reqUrlhasPrefix:@"alipays://"] || [reqUrlhasPrefix:@"alipay://"]) {

        BOOL bSucc = [[UIApplication sharedApplication]openURL:[NSURL URLWithString:reqUrl]];

        //bSucc是否成功调起支付宝

        if(!bSucc) {

            [UtilityshowTipsWithHUD:@"请先安装支付宝"showTime:2];

        }

    }elseif([reqUrlhasPrefix:@"weixin://"]) {

        BOOL bSucc = [[UIApplication sharedApplication]openURL:[NSURL URLWithString:reqUrl]];

        //bSucc是否成功调起微信

        if(!bSucc) {

            [UtilityshowTipsWithHUD:@"请先安装微信"showTime:2];

        }

    }


    return YES;

}

你可能感兴趣的:(iOS UIWebView 调用支付宝或微信支付)