您的位置:首页 > 其它

使用URL SCHEME启动淘宝客户端并跳转到某个商品页面的方法

2015-12-03 16:51 483 查看
// 构建淘宝客户端协议的 URL
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"taobao://item.taobao.com/item.htm?id=%@", itemId]];

// 判断当前系统是否有安装淘宝客户端
if ([[UIApplication sharedApplication] canOpenURL:url]) {
// 如果已经安装淘宝客户端,就使用客户端打开链接
[[UIApplication sharedApplication] openURL:url];

} else {
// 否则使用 Mobile Safari 或者内嵌 WebView 来显示
url = [NSURL URLWithString:[NSString stringWithFormat:@"http://item.taobao.com/item.htm?id=%@", itemId]];
//        [[UIApplication sharedApplication] openURL:url];

[self tongwanWeb:url];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: