• 有关UIWebView的SSL总结


    在网上找了非常多文章差点儿相同都是一样的,基本上都是关于NSURLConnection的文章。

    如今把几个比較好的连接分享给大家http://blog.csdn.net/pingchangtan367/article/details/8264858 、http://www.cocoachina.com/ask/questions/show/97761 。这个是总结比較好的文章。

    另一种方法就是ios7出现的。文章不多。是NSURLSession的使用。參考:http://blog.csdn.net/kyfxbl/article/details/25713681?

    reload

    用的2这样的方法都无法完毕,另外一种方法使用时,服务端收不到不论什么请求。直接拦截掉了。后面在研究下。

    眼下使用的是第一种方法。问题可能是url不是标准的https的。如今是直接读取得到的data..。

    [m_webViewloadHTMLString:str baseURL:nil]; 用


    [m_webView loadRequest:m_request];这种方法是载入不到内容的。

    会显示"INVALID_TOKEN”。

    以下在介绍个NSURLConnection的方法。这种方法没有实验成功。

    NSOperationQueue *_queue = [[NSOperationQueue alloc]init];
    [NSURLConnection sendAsynchronousRequest:m_request queue:_queue  completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
                if (connectionError) {
                    NSLog(@"Httperror:%@%ld", connectionError.localizedDescription,(long)connectionError.code);
                }else{
                    //NSInteger code=[(NSHTTPURLResponse*)response statusCode];
               //          NSLog(@"didReceiveResponse....code=%ld",(long)code);
                    NSString *str=[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
                    //NSLog(@"didReceiveData....data=%@",str);
                    [m_webView loadHTMLString:str baseURL:nil];
                }
            }];


    參考:https://developer.apple.com/library/prerelease/iOS/documentation/Foundation/Reference/NSURLSessionConfiguration_class/index.html#//apple_ref/occ/instp/NSURLSessionConfiguration/TLSMinimumSupportedProtocol、

    http://blog.iamzsx.me/show.html?

    id=155002、http://blog.csdn.net/xyz_lmn/article/details/8968182、http://blog.csdn.net/shouqiangwei/article/details/25897941、http://objccn.io/issue-5-4/

  • 相关阅读:
    angular 1.26 版本 window.history.back() 自动去顶部
    CK editor 制作 ”小“plugin
    CSS 3 过渡效果之jquery 的fadeIn ,fadeOut
    了解 : angular controller link nginit 顺序
    规范 : jobbox 中英文
    了解 : angular translate 和 google translate 和 微软 translate
    业务逻辑 : 未完 : easybook.com
    List和ArrayList的区别
    Select什么时候会产生重作日志
    几点对专用服务器与共享服务器差异的理解
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5140132.html
Copyright © 2020-2023  润新知