应用程序调用QQ聊天

需要在Info中添加 LSApplicationQueriesSchemes,并添加itme  值为 mqq

-(void)connectButton:(UIButton *)button{

//联系客服

//是否安装QQ

if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]])

{

//用来接收临时消息的客服QQ号码(注意此QQ号需开通QQ推广功能,否则陌生人向他发送消息会失败)

NSString *QQ = qqNum;

//调用QQ客户端,发起QQ临时会话

NSString *url = [NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",QQ];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

}

}

你可能感兴趣的:(应用程序调用QQ聊天)