webview里拦截url
requesting是url的absultestring
if ([requestString containsString:@"weixin://"]) {//支付宝是alipays://
NSRange range = [requestString rangeOfString:@"weixin://"]; //截取的字符串起始位置
NSString * resultStr = [requestString substringFromIndex:range.location]; //截取字符串
NSURL *weixinURL = [NSURL URLWithString:resultStr];
[[UIApplication sharedApplication] openURL:weixinURL options:@{UIApplicationOpenURLOptionUniversalLinksOnly: @NO} completionHandler:^(BOOL success) {
}];
}
网友评论