[英]iOS App Transport Security
我在一个包含许多不同 URL 的应用程序上有列表; 因此,我已将 info.plist 设置为...
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
在模拟器上一切正常。 在我的测试设备上它不起作用。
错误是...
2015-11-10 18:58:05.159 MPSTApp[520:169178] -canOpenURL:URL 失败:“https://www.facebook.com/prontosantateresa -- file:///” - 错误:“这个应用程序不是允许查询方案文件"
调用 url 链接的代码是这样的 -
var anchorLink: String?
func loadWebPage(){
let requestURL = NSURL(string: anchorLink!)
let request = NSURLRequest(URL: requestURL!)
webView.loadRequest(request)
}
您的 URL 中存在拼写错误。 改变:
https:/facebook.com
到:
https://facebook.com
此外,您应该将LSAllowsArbitraryLoads
更改回默认值,因为这最适合大多数应用程序。
对于 iOS9,您必须在 plist 文件中添加一些内容:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
</array>
更多信息:为 iOS9 准备你的应用程序
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.