1.打开抖音:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",@"snssdk1128://"]];
if ([[UIApplication sharedApplication]canOpenURL:url]) {
url = [NSURL URLWithString:[NSString stringWithFormat:@"snssdk1128://live?room_id=%@",@"房间ID"]];
[[UIApplication sharedApplication] openURL:url];
}else{
url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",@"https://apps.apple.com/cn/app/%E6%8A%96%E9%9F%B3/id1142110895"]];
[[UIApplication sharedApplication] openURL:url];
}
2.打开哔哩哔哩:
NSString*urls = [NSStringstringWithFormat:@"bilibili://live/%@",@"传入ID"];
NSURL*url = [NSURLURLWithString:urls];
if ([[UIApplication sharedApplication]canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}else{
url = [NSURL URLWithString:[NSString stringWithFormat:@"%@", @"https://apps.apple.com/cn/app/%E5%93%94%E5%93%A9%E5%93%94%E5%93%A9-%E5%BC%B9%E5%B9%95%E7%95%AA%E5%89%A7%E7%9B%B4%E6%92%AD%E9%AB%98%E6%B8%85%E8%A7%86%E9%A2%91/id736536022"]];
[[UIApplication sharedApplication] openURL:url];
}
3.打开快手:
NSString*urls = [NSString stringWithFormat:@"kwai://work/%@",@"传入对应ID"];
NSURL*url = [NSURL URLWithString:urls];
if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",@"kwai://"]]]) {
[[UIApplication sharedApplication] openURL:url];
}else{
url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",@"https://apps.apple.com/cn/app/%E5%BF%AB%E6%89%8B/id440948110"]];
[[UIApplication sharedApplication] openURL:url];
}
4.淘宝:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",self.infoModel.taobao_url]];
NSURL *taobaoUrl = [NSURL URLWithString:[NSString stringWithFormat:@"taobao://item.taobao.com/item.htm?id=%@",@"对应商品ID"]];
if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",@"taobao://"]]]) {
[[UIApplicationsharedApplication]openURL:taobaoUrl];
}else{
url = [NSURL URLWithString:[NSString stringWithFormat:@"%@", self.infoModel.taobao_url]];
[[UIApplication sharedApplication] openURL:url];
}
网友评论