Swift跳QQ聊天
1.在项目info.plist添加LSApplicationQueriesSchemes字段 类型Array
2.在此Array中添加一个 item 值设为:mqq
if(UIApplication.shared.canOpenURL(URL(string: "mqq://")!)){
let str = String(format: "mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web", qqNumber)
UIApplication.shared.openURL(URL(string: str)!)
}else{
addHint(_msg: "没有发现QQ")
}
网友评论