swift - xcode 7 swiftui webview https输出语句

标签 swift webview xcode7

xcode 7 swift,我的 webview 使用 https,应用程序成功加载页面,但它说 "2015-10-05 18:03:51.204 HKCateringApp[1326:45336] NSURLSession/NSURLConnection HTTP 加载失败(kCFStreamErrorDomainSSL,-9824)” 请帮忙解决一下。这是我的代码:

    let URL = NSURL(string: "https://www.ssls.com")

    WebView.loadRequest(NSURLRequest(URL: URL!))

最佳答案

您必须在 info.plist 文件的 NSAppTransportSecurity 字典中将 NSAllowsArbitraryLoads 键添加为 YES。 iOS 9.0 中有一些新功能,所以你必须这样做。

例如,

 <key>NSAppTransportSecurity</key>
 <dict>
      <key>NSAllowsArbitraryLoads</key>
     <true/>
 </dict>

关于swift - xcode 7 swiftui webview https输出语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32945982/

相关文章:

java - Android JavaScript Bridge - 触发事件

flutter - 如何在 Flutter 中使用 BottomNavigationBar 维护 Webview 状态

xcode7 - 该设备当前不在线

swift - CABasicAnimation 忽略持续时间

android - 恢复包含动态生成的 HTML 的 webview 状态

swift - SKScene 中的应用程序购买不起作用?

swift - Swift 2.1.1 中的获取请求

xcode - ctrl + 拖动到错误的 swift 文件

swift - 静态协议(protocol)扩展生成非法指令编译器错误

ios - 关于 Apple 的 WWDC 2017 Session 506 中的代码摘录 - exifOrientationFromDeviceOrientation() 在哪里定义?