两句话跳转QQ聊天界面 通过web方式

 

NSString *qq=[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",@"11027037153"];
    NSURL *url2 = [NSURL URLWithString:qq];
    if ([[UIApplication sharedApplication] canOpenURL:url2]) {
        [[UIApplication sharedApplication] openURL:url2];
    }else{
        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"对不起,您还没安装QQ" preferredStyle:UIAlertControllerStyleAlert];
        
        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
            return ;
        }];
        [alertController addAction:cancelAction];
        [self presentViewController:alertController animated:YES completion:nil];
    }

 

posted @ 2017-09-25 11:44  宁静暖风  阅读(823)  评论(0编辑  收藏  举报