iOS url scheme打开常见的app 并且跳到对应app方法

释放双眼,带上耳机,听听看~!

1.打开抖音:

NNSURL *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.打开哔哩哔哩:

 

SString*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];

    }

 

人已赞赏
iOS文章

iOS开发UITableViewCell上放CollectionView,cell高度自适应

2021-3-30 13:17:07

iOS文章

iOS TableView reloadData 动画防抖

2021-3-30 15:47:08

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索