App TranSport安全性,允许在升级到IOS 10.1后任意负载不起作用
嗨,我有一个在ios 9和10.0中运行良好的应用程序(我已将“允许任意加载= YES”的App Transport Security阻止添加到我的info.plist。但升级到10.1和Xcode 8.1后似乎有问题使用App Transport Security。我无法连接到服务器。我的服务器仅支持TLS 1.1
显示此错误
Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
可能是IOS 10.1忽略.plist信息。 有谁有这个问题? 任何帮助都非常感激。 谢谢(注意。在9.3到10.0仍然正常工作)
我的.plist文件
CFBundleDevelopmentRegion en CFBundleDisplayName SingPost CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.8.7 CFBundleSignature ???? CFBundleURLTypes CFBundleURLSchemes fb1540614276180366 Item 0 fb1540614276180366 CFBundleVersion 1.8.7 FacebookAppID 1540614276180366 FacebookDisplayName Singpost LSRequiresIPhoneOS NSAppTransportSecurity NSAllowsArbitraryLoads NSAllowsArbitraryLoadsInWebContent NSExceptionDomains prdesb1.singpost.com NSIncludesSubdomains NSTemporaryExceptionAllowsInsecureHTTPLoads NSTemporaryExceptionMinimumTLSVersion TLSv1.1 NSTemporaryExceptionRequiresForwardSecrecy mobile.singpost.com NSIncludesSubdomains NSTemporaryExceptionAllowsInsecureHTTPLoads NSTemporaryExceptionMinimumTLSVersion TLSv1.1 NSTemporaryExceptionRequiresForwardSecrecy NSCameraUsageDescription $(PRODUCT_NAME) camera use NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription NSPhotoLibraryUsageDescription $(PRODUCT_NAME) uses photos UIAppFonts OpenSans-Regular.ttf OpenSans-Bold.ttf OpenSans-Semibold.ttf OpenSans-Light.ttf OpenSans-LightItalic.ttf UIBackgroundModes remote-notification UIRequiredDeviceCapabilities armv7 UIRequiresFullScreen UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait
我修复了我的add exeptiondomain但在控制台中出现此错误
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) –
从建议编辑。 我改变了我的plist
mobile.singpost.com NSIncludesSubdomains NSExceptionAllowsInsecureHTTPLoads NSExceptionMinimumTLSVersion TLSv1.1 NSExceptionRequiresForwardSecrecy mysam.sg NSIncludesSubdomains NSExceptionAllowsInsecureHTTPLoads NSExceptionMinimumTLSVersion TLSv1.1 NSExceptionRequiresForwardSecrecy
通过指定NSAllowsArbitraryLoadsInWebContent
,您将覆盖iOS 10上的NSAllowsArbitraryLoads
。
在iOS 10及更高版本以及macOS 10.12及更高版本中,如果应用程序的Info.plist文件中存在以下任何键,则会忽略[
NSAllowsArbitraryLoads
]键的值 :
- NSAllowsArbitraryLoadsForMedia
- NSAllowsArbitraryLoadsInWebContent
- NSAllowsLocalNetworking
来源: App Transport Security字典主键 (Apple)
此外,您提供的NSExceptionDomain
词典似乎与当前记录的格式不匹配。 具体来说,键不匹配:
-
NSTemporaryExceptionAllowsInsecureHTTPLoads
应为NSExceptionAllowsInsecureHTTPLoads
-
NSTemporaryExceptionMinimumTLSVersion
应为NSExceptionMinimumTLSVersion
-
NSTemporaryExceptionRequiresForwardSecrecy
应该是NSExceptionRequiresForwardSecrecy