iOS开发之调起QQ客户端

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

    LSApplicationQueriesSchemes
    
        wechat
        weixin
        alipay
        alipayshare
        mqq
    
    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客户端)