美文网首页
iOS开发之调起QQ客户端

iOS开发之调起QQ客户端

作者: 向晚forever | 来源:发表于2016-11-25 18:17 被阅读24次

需要注意的是,iOS9以上的系统需要在info.plist添加白名单

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>wechat</string>
        <string>weixin</string>
        <string>alipay</string>
        <string>alipayshare</string>
        <string>mqq</string>
    </array>
    if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]])
    {
        NSString *QQ = @"1099779883";
        //调用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]];
    }
    else{
        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"手机未安装QQ" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [alert show];
    }

相关文章

网友评论

      本文标题:iOS开发之调起QQ客户端

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