iOS跳转QQ聊天应用

来源:互联网 发布:灯杆数据基础调研 编辑:程序博客网 时间:2024/05/01 18:17

首先在info.plist里面添加LSApplicationQueriesSchemes(Array类型)
然后插入weixin, wechat, mqq的string类型子项,如下图:

// 判断手机是否安装QQ 微信App

// 判断手机是否安装QQ    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]]) {        NSLog(@"install--");    }else{        NSLog(@"no---");    }
// 判断手机是否安装微信    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weixin://"]]) {        NSLog(@"install--");    }else{        NSLog(@"no---");    }

// 跳转QQ应用

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];    // 提供uin, 你所要联系人的QQ号码    NSString *qqstr = [NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",model.uin];    NSURL *url = [NSURL URLWithString:qqstr];    NSURLRequest *request = [NSURLRequest requestWithURL:url];    [webView loadRequest:request];    [self.view addSubview:webView];
原创粉丝点击