app跳转到京东的某个页面

来源:互联网 发布:电力网络指 编辑:程序博客网 时间:2024/06/05 08:31

参考: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];        }
阅读全文
0 0