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]; }
时间: 2024-10-11 20:25:02