美文网首页
iOS url scheme打开常见的app 并且跳到对应房间方

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

作者: iOSEer冷箭 | 来源:发表于2021-02-26 13:44 被阅读0次

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

        }

    相关文章

      网友评论

          本文标题:iOS url scheme打开常见的app 并且跳到对应房间方

          本文链接:https://www.haomeiwen.com/subject/fhuufltx.html