swift - 如何快速加载本地主机

标签 swift uiwebview

伙计们,我创建了一个基于 Web View 的 iOS 应用程序。在启动之前,我必须测试它,但我无法在测试应用程序中加载本地主机

这个方法我试过了

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>192.168.0.189</key>
        <string></string>
        <key>ExceptionAllowsInsecureHTTPLoads</key>
        <true/>
        <key>localhost:port</key>
        <string></string>
    </dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

还有其他方法吗?

最佳答案

试试这个!

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>192.168.0.189</key>
        <dict>
        <key>NSIncludesSubdomains</key>
        <true/>
        <key>NSExceptionAllowsInsecureHTTPLoads</key>
        <true/>
        <key>NSExceptionRequiresForwardSecrecy</key>
        <true/>
        <key>NSExceptionMinimumTLSVersion</key>
        <string>TLSv1.2</string>
        <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
        <false/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
        <true/>
        <key>NSThirdPartyExceptionMinimumTLSVersion</key>
        <string>TLSv1.2</string>
        <key>NSRequiresCertificateTransparency</key>
        <false/>
    </dict>
    </dict>
</dict>

关于swift - 如何快速加载本地主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58968232/

相关文章:

ios - 从 UIWebView 进行 PDF 分页

javascript - 在 Web View 中将视频流从 iOS7 摄像头发送到 JavaScript Canvas

IOS无论如何在整个应用程序中都有NSAttributedString。 swift

android - Swift AES 加密抛出错误,而在 Android 中则不会

iOS 8 远程通知 - 我应该何时调用 registerForRemoteNotifications()?

ios - 自动布局边界始终为零

iOS UIWebView 泄露

ios - 登录或取消 firebase 社交登录后 View 错位 swift

iphone - 调用 webViewDidStartLoad 时获取 URL?

iPhone UIWebView - 如何设置缩放级别和位置?