APP开发的时候,有时需求是调起QQ,并跳转到指定QQ聊天页面的方法,如下:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]]) {
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",QQ]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
webView.delegate = self;
[webView loadRequest:request];
[self.view addSubview:webView];
}else{
UIAlertView * alter = [[UIAlertView alloc]initWithTitle:@"打开客服提醒" message:@"您尚未安装QQ,请安装QQ后重试!" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alter show];
return;
}
本文介绍了一种在APP开发中调用QQ并直接跳转到指定聊天页面的方法,使用mqq协议和UIWebView组件实现跨应用通讯。
9万+

被折叠的 条评论
为什么被折叠?



