将 Arbitrary Loads 设置为 YES 后 App Transport Security 策略错误

App Transport Security policy error after setting Arbitrary Loads to YES

我在我的项目中遇到这个错误

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

这是我知道的常见问题,但答案不是

adding App Transport Security Settings in info.plist and setting the Allow Arbitrary Loads to YES

因为我已经这样做了,而且它适用于我的每个项目,但由于某种原因,我目前正在从事的项目没有奏效。 不确定我做错了什么?

这是应用程序传输安全设置下的info.plist

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>The domain</key>
            <dict>
                <key>**my domain here**</key>
                <dict/>
            </dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSAllowsArbitraryLoadsForMedia</key>
        <true/>
        <key>NSAllowsArbitraryLoadsInWebContent</key>
        <true/>
    </dict>
</dict>

这个结构是错误的:

    <key>NSExceptionDomains</key>
    <dict>
        <key>The domain</key>
        <dict>
            <key>**my domain here**</key>
            <dict/>
        </dict>
        <key>NSIncludesSubdomains</key>
        <true/>
        <key>NSExceptionAllowsInsecureHTTPLoads</key>
        <true/>
    </dict>

应该是:

    <key>NSExceptionDomains</key>
    <dict>
        <key>The domain</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>