ionic 发送https请求无响应问题(大坑)

接触到ionic已经有一年的时间了,以前一直没有时间来整理遇到的坑,最近项目不怎忙了,来整理整理,希望对道友们有些帮助。

1.基于iOS平台
    1.1 参考道友 http://blog.csdn.net/u012794461/article/details/50564383

 

    修改webstrom 工程platforms-->MyApp-->AppDelegate.m-->在末尾追加如下代码:
    @implementation NSURLRequest(DataController)
    + (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
    {
     return YES;
    }
   @end

2.基于android平台

    2.1 参考道友  http://blog.csdn.net/zhangjianying/article/details/51829548

    修改 \platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemWebViewClient 文件里的 onReceivedSslError 函数
    原来的代码意思是debug模式下,ionic会跳过证书的认证,这时候访问https是没有问题的。 如果发布release版本,则会对证书进行认证。
      public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
          handler.proceed();
      }

 

 

        

 

 

 

 

 

 

 

 

 

 

    

 

你可能感兴趣的:(ionic)