ios - 无法在 iOS 9 的 UIWebView 中加载 HTTP 链接

标签 ios uiwebview ios9 xcode7 nsapptransportsecurity

我正在尝试在 UIWebView 中加载 HTTP 链接。这些链接来 self 的网站,因此它们是可靠的。我在网上搜索并在此处找到了解决方案:How can I add NSAppTransportSecurity to my info.plist file?

按照该解决方案后,我的 info.plist 看起来像这样:

enter image description here

即使进行更改后,我也无法在 UIWebView 中加载 HTTP 链接。我收到以下错误:

App Transport Security 已阻止明文 HTTP (http://) 资源加载,因为它不安全

我做错了什么吗?

更新:

按照 Ramshad 在评论中建议的进行更改后,它仍然不起作用。 见下图:

enter image description here

最佳答案

应该是这样的,你需要在你的Plist中添加如下记录 Apple Documentation

NSAppTransportSecurity <- 类型字典

NSAllowsArbitraryLoads <- 类型 bool 值 YES

enter image description here

关于ios - 无法在 iOS 9 的 UIWebView 中加载 HTTP 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32690789/

相关文章:

ios 7 - 从图库中选择照片会重置 statusBarStyle

uinavigationcontroller - UISplitViewController 中开始/结束外观转换的不平衡调用

protocols - Swift 2 在协议(protocol)扩展 "Cannot use mutating member on immutable value: ' self' 中使用变异函数时出错

xcode7 - 使用点播资源从 Assets 目录获取视频

ios - 中断 UIView 转换

objective-c - 显示全景图像时内存泄漏

ios - ViewWillTransitionToSize 打破了 Swift 3?

ios - 从 CMPedometer 检索数据时出现问题 : "Error on message reply (Connection invalid)"

ios - 提交到应用商店时 Cordova "Apple will stop accepting submissions of apps that use UIWebView"警告

iphone - 当点击 epub 文件页面时 如何更改 iPhone 应用程序 epub 文件文本的字体大小?