如何在我的info.plist文件中禁用NSAppTransportSecurity?
这就是我的要求
func request(){
let url = NSURL(string: "https://www.widadclub.tk/feed/")
let feedParser = MWFeedParser(feedURL: url)
feedParser.delegate = self
feedParser.parse()
}发布于 2015-10-08 22:47:06
要完全禁用所有域的NSAppTransportSecurity,请使用文本编辑器打开plist文件,然后添加:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- .......................... -->
<!-- Other keys already present -->
<!-- .......................... -->
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>要将特定例外添加到域列表中,请改为添加以下内容:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- .......................... -->
<!-- Other keys already present -->
<!-- .......................... -->
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>widadclub.tk</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>NSIncludesSubdomains不是必需的,但允许访问wiki.widadclub.tk、blog.widadclub.tk等子域。
有关详细的教程,请查看this blog post
发布于 2015-07-24 16:51:19
您可以将例外添加到Info.plist文件。下面是最终的字典应该是什么样子的。注意:我添加了所有可用的例外,选择适用于您的例外。例如,如果您不需要1.1的最低TLS版本,就不要包含该键。在当前的测试版中,键在info.plist中没有自动完成功能,所以我在底部添加了字符串,以方便复制粘贴。

NSAppTransportSecurity
NSExceptionDomains
NSIncludesSubdomains
NSTemporaryExceptionAllowsInsecureHTTPLoads
NSTemporaryExceptionMinimumTLSVersion
NSTemporaryExceptionRequiresForwardSecrecyhttps://stackoverflow.com/questions/31466297
复制相似问题