2

我在用

  • “react-native-webview”:“7.4.3”
  • "expokit": "^36.0.0",

当我在自签名证书服务器上使用 URL 运行应用程序时,将出现如下错误消息。如果将 URL 更改为具有正确颁发证书的服务器,则不会显示错误。

Encountered an error loading page, Object {
  "canGoBack": false,
  "canGoForward": false,
  "code": -1202,
  "description": "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “xxxxx.xxx.xxx” which could put your confidential information at risk.",
  "didFailProvisionalNavigation": true,
  "domain": "NSURLErrorDomain",
  "loading": false,
  "target": 265,
  "title": "",
  "url": "",
}

我在 Info.plist 中尝试了以下设置

    <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
            <key>NSAllowsArbitraryLoadsInWebContent</key>
            <true/>
            <key>NSExceptionDomains</key>
            <dict>
                <key>xxx.xxx.xx.xx</key>
                <dict>
                    <key>NSExceptionAllowsInsecureHTTPLoads</key>
                    <true/>
                    <key>NSExceptionRequiresForwardSecrecy</key>
                    <false/>
                    <key>NSIncludesSubdomains</key>
                    <true/>
                </dict>
            </dict>
        </dict>

一段描述自签名证书,但不太确定如何配置它。有人对此有想法吗?

4

0 回答 0