如何解决“Error Domain=kCFErrorDomainCFNetwork Code=-1022”(null)”错误
How to Solve " Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)" Error
我在 info.plist
中添加了 AppTransportSecurity
键,并且
添加了一个名为 AllowsArbitraryLoads
的子项作为布尔值,并将其值设置为 YES,如下图所示。
但仍然显示此错误:
{Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"},
NSErrorFailingURLKey=http://dtcws.azurewebsites.net/ShowImg.aspx?params=dtc_376_0_True_False_22,
NSLocalizedDescription=The resource could not be loaded because the
App Transport Security policy requires the use of a secure
connection.})
有人可以帮忙吗?
最好的解决方案是使用安全连接(https
而不是 http
),因为 Apple 将来会拒绝不支持此功能的应用程序,如果它们还没有开始的话已经。 WWDC 2015 session 703, “Privacy and Your App” 是一个很棒的session,如果你还没有看过的话。
好消息是您请求的网站本身支持 https
,因此您只需在 link.
中添加一个 s
您能否在 App Transport Security 下添加 "Exception Domains" 并指定域。
我在 info.plist
中添加了 AppTransportSecurity
键,并且
添加了一个名为 AllowsArbitraryLoads
的子项作为布尔值,并将其值设置为 YES,如下图所示。
但仍然显示此错误:
{Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLKey=http://dtcws.azurewebsites.net/ShowImg.aspx?params=dtc_376_0_True_False_22, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.})
有人可以帮忙吗?
最好的解决方案是使用安全连接(https
而不是 http
),因为 Apple 将来会拒绝不支持此功能的应用程序,如果它们还没有开始的话已经。 WWDC 2015 session 703, “Privacy and Your App” 是一个很棒的session,如果你还没有看过的话。
好消息是您请求的网站本身支持 https
,因此您只需在 link.
s
您能否在 App Transport Security 下添加 "Exception Domains" 并指定域。