[报错]iOS App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure

问题描述

WebView加载http链接时没有显示出网页,并提示

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

原因是,苹果希望你使用https协议,所以默认拦截了http请求

解决方法

  1. 在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary
  2. 在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean ,值设为 YES
info.plist

你可能感兴趣的:([报错]iOS App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure)