iOS 允许http请求

iOS 允许http请求

gaoyanchen Lv3

以下两种情况允许 http 请求

允许个别域名 http 请求:

(1) NSAllowsArbitraryLoads: false,

(2) NSExceptionDomains内NSExceptionAllowsInsecureHTTPLoads: true

NSAppTransportSecurity

<dict>

    <key>NSAllowsArbitraryLoads</key>

    <flase/>

    <key>NSExceptionDomains</key>

    <dict>

        <key>aliyuncs.com</key>

        <dict>

            <key>NSExceptionAllowsInsecureHTTPLoads</key>

            <true/>

        </dict>

    </dict>

</dict>

允许所有 http 请求:

(1) NSAllowsArbitraryLoads: true

(2) 不设置NSExceptionDomains

NSAppTransportSecurity

<dict>

    <key>NSAllowsArbitraryLoads</key>

    <true/>

</dict>
  • Title: iOS 允许http请求
  • Author: gaoyanchen
  • Created at : 2024-09-09 19:07:05
  • Updated at : 2024-09-12 15:03:46
  • Link: https://gyc.660624.xyz/2024/09/09/iOS 允许http请求/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments