参考:https://www.china-7.net/view-486463.html

对于系统iOS 9来说,把需要检测的UrlScheme添加到白名单即可,添加方法:info.plist 增加LSApplicationQueriesSchemes (array类型),把要检测的app的UrlScheme加进去。

//查看京东订单页(其他页面替换des对应的value值)
        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:@{@"category":@"jump",@"des":@"orderlist",@"skuId":@"1157957",@"sourceType":@"homefloor",@"sourceValue":@"4384",@"landPageId":@"jshop.cx.mobile"} options:NSJSONWritingPrettyPrinted error:nil];
        NSString *valueString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
        NSString *urlString=[NSString stringWithFormat:@"openapp.jdmobile://virtual?params=%@",valueString];
        urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSURL *url=[NSURL URLWithString:urlString];
        if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"openApp.jdMobile://"]]) {//判断手机上是否有安装京东
            [[UIApplication sharedApplication] openURL:url];
        }else {
            TZWebViewController *webController = [[TZWebViewController alloc] init];
            webController.urlStr = @"https://plogin.m.jd.com/user/login.action?appid=100&kpkey=&returnurl=http%3A%2F%2Fhome.m.jd.com%2FmyJd%2Fhome.action%3Fsid%3D3d5207088d91270297082c1b8e7c3867";
            [self.navigationController pushViewController:webController animated:YES];
        }
Logo

电商企业物流数字化转型必备!快递鸟 API 接口,72 小时快速完成物流系统集成。全流程实战1V1指导,营造开放的API技术生态圈。

更多推荐