zoukankan      html  css  js  c++  java
  • iOS 打开 QQ 聊天的实现 以及正常接收消息的设置

    iOS 打开 QQ 聊天的实现 以及正常接收消息的设置

      //qqNumber就是你要打开的QQ号码, 也就是你的客服号码。
       NSString  *qqNumber=@"1918263902";
    
        if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]]) {
          UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
          NSURL * url=[NSURL URLWithString:[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",qqNumber]];
    
          NSURLRequest *request = [NSURLRequest requestWithURL:url];
          webView.delegate = self;
          [webView loadRequest:request];
          [self.view addSubview:webView];
    }else{
    
          UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"nil" message:@"对不起,您还没安装QQ" preferredStyle:UIAlertControllerStyleAlert];
    
          UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
    
              [tableView deselectRowAtIndexPath:indexPath animated:NO];
              return ;
        }];
    
          [alertController addAction:cancelAction];
          [self presentViewController:alertController animated:YES completion:nil];

    注意:如果你的QQ不是客服QQ会出现红色的感叹号如下:


     
    解决方案 打开QQ推进行设置一下就可以了

    具体步骤如下:


    1.打开http://shang.qq.com/v3/index.html 点击推广工具------> 点击立即免费开通


     

    2.点击QQ通讯组件------>选择标准型组件样式 点击设置


     
    3.设置自动回复 和 会话能力

     

    4.向下滚动设置权限和安全级别


     

    设置完之后大家再试一下 就可以正常接收陌生人聊天了



    文/红姑娘(简书作者)
    原文链接:http://www.jianshu.com/p/d306a443bcc8
    著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
    感谢您的访问! 若对您有帮助或有兴趣请关注博客:http://www.cnblogs.com/Rong-Shengcom/
  • 相关阅读:
    cmake默认变量
    关于字符编码
    cmake 变量
    动态库对外暴露api的方法
    vs2013工程技巧
    大学毕业4年-未来展望(1)-商业研究
    大学毕业4年-未来展望-序
    大学毕业4年-未来展望-序
    大学毕业4年-回顾和总结(3)-投资理财观-图穷而真相现
    大学毕业4年-回顾和总结(3)-投资理财观-图穷而真相现
  • 原文地址:https://www.cnblogs.com/Rong-Shengcom/p/6141307.html
Copyright © 2011-2022 走看看