APP跳转至QQ客服

作者: 睿少 | 来源:发表于2017-10-16 11:06 被阅读0次

在日常开发中,常常有需求要求在开发的app中跳转至QQ指定的账户。

首先要判断设备中是否有QQ
如果设备中已经装好QQ,就直接跳转至指定QQ号对话框
否则弹窗提示用户。

NSString *url = @"mqqwpa://im/chat?chat_type=crm&uin=QQ号&version=1&src_type=web&web_src=http:://wpa.b.qq.com";
    NSURL *qqURL = [NSURL URLWithString:url];
    BOOL hasInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]];
    
    if (!hasInstalled) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" 提示 " message:@" 请先安装 QQ" delegate:nil cancelButtonTitle:@" 确定 " otherButtonTitles:nil, nil];
        [alert show];
//        [[UIApplication sharedApplication] openURL:qqURL];
    } else {
        [[UIApplication sharedApplication] openURL:qqURL];
    }

相关文章

网友评论

    本文标题:APP跳转至QQ客服

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