iOS 对https App内部的http请求进行白名单设置

苹果从iOS9开始要求应用使用Https链接来对请求进行加密,来保证数据的安全.如果使用http请求将会报错,当然,如果你想继续使用http请求,有两种方式:

1.使用ASIHttpRequest来请求,ASI是使用CFNetwork来处理请求的,更底层些,避开了苹果的限制

2.在Info.plist文件设置如下

NSAllowsArbitraryLoads

目前,应用基本是都https请求了,但有的第三方请求需要http,这个时候就需要白名单了,设置如下:

        NSAllowsArbitraryLoads

       

NSExceptionDomains

            youappdomain.com

           

                NSExceptionAllowsInsecureHTTPLoads

               

                NSExceptionRequiresForwardSecrecy

               

                NSIncludesSubdomains

               

                NSThirdPartyExceptionRequiresForwardSecrecy

               

            aliyuncs.com

           

                NSExceptionAllowsInsecureHTTPLoads

               

                NSExceptionRequiresForwardSecrecy

               

                NSIncludesSubdomains

               

                NSThirdPartyExceptionRequiresForwardSecrecy

               

           

你可能感兴趣的:(iOS 对https App内部的http请求进行白名单设置)