Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
除非我允许任意域名,否则Swift curl到第三方网站不起作用_Swift_Http_Https - Fatal编程技术网

除非我允许任意域名,否则Swift curl到第三方网站不起作用

除非我允许任意域名,否则Swift curl到第三方网站不起作用,swift,http,https,Swift,Http,Https,我的要求看来是这样的 let headers = ["Host:" : "www.fortune500companysite.com", "User-Agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:50.0) Gecko/20100101 Firefox/50.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Ac

我的要求看来是这样的

let headers = ["Host:" : "www.fortune500companysite.com", "User-Agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:50.0) Gecko/20100101 Firefox/50.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language" : "en-US,en;q=0.5", "Connection" : "keep-alive", "Upgrade-Insecure-Requests" : "1"]
        let request = formatRequest(url: "https://www.fortune500companysite.com/", method: "GET", headers: headers, dataString: nil)
我需要帮助格式化我的info.plist,以便请求(和子域请求)可以工作,并且苹果可以批准该应用程序

发送请求仅适用于以下情况:

<dict>
    <!--Include to allow all connections (DANGER)-->
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
我在别人的问题中找到的代码也没有帮助

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>fortune500companysite.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <true/>
                <key>NSExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
                <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <true/>
                <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
                <key>NSRequiresCertificateTransparency</key>
                <false/>
            </dict>
        </dict>
    </dict>
NSAppTransportSecurity
NSExceptionDomains
财富500公司网站
n包括多个域
N异常低安全Http负载
NSExceptionRequiresForwardSecretary
NSExceptionMinimumTLSVersion
TLSv1.2
N第三方异常低安全Http负载
N第三方例外要求转发保密
第三方例外最小版本
TLSv1.2
NSRequiresCertificateTransparency

给出了“TLSv1.2”吗?@shallowthough你是什么意思,我不明白这些东西的大部分只是从溢出的答案中拼凑出我能做的。在这种情况下,我建议搜索错误。给出了“TLSv1.2”吗?@shallowthough你是什么意思,我不理解这些东西的大部分,只是从Overflow上已经给出的答案中拼凑出了我能做的。在这种情况下,我建议搜索错误。
<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>fortune500companysite.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <true/>
                <key>NSExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
                <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <true/>
                <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
                <key>NSRequiresCertificateTransparency</key>
                <false/>
            </dict>
        </dict>
    </dict>