允许HTTP而不在iOS中禁用ATS [英] Allow HTTP without disabling ATS in iOS

查看:215
本文介绍了允许HTTP而不在iOS中禁用ATS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个有一个小调整的应用程序。它将显示给定网址的预览(如Facebook,whatsapp确实)。但如果用户指定网址是HTTP,我无法在打开ATS时加载预览。所以我使用 NSAllowsArbitraryLoads 关闭了整个HTTPS流量。有没有办法允许http启用ATS?

I am developing an app which have a small tweak in it. it will show a preview of the given url (like Facebook,whatsapp does). but if the "User-given" url is in HTTP, I couldn't load the preview when ATS is turned on. so i turned off the whole HTTPS traffic by using NSAllowsArbitraryLoads . is there any way to allow http with ATS enabled?

推荐答案

根据Apple ,如果你建立一个较旧的SDK,因此iOS 8或更早版本,然后禁用ATS。我不确切地知道这意味着什么,但我猜它是目标构建设置架构,基础SDK - 而不是部署目标设置。

According to Apple, if you build against an older SDK, so iOS 8 or earlier, then ATS is disabled. I don't know exactly what this means, but I'm guessing it is the target build setting Architectures, Base SDK -- not the deployment target setting.

此视频详细介绍了最近在2016年WWDC上宣布的ATS变化。截至开始2017年,如果您使用以下任何ATS例外,Apple将拒绝您的应用 AND 您无法提供合理的理由:

This video has details of changes to ATS recently announced at WWDC 2016. As of the start of 2017, Apple will reject your app if you're using any of the following ATS exceptions AND you can't provide a reasonable justification for doing so:


  • NSAllowsArbitraryLoads

  • NSExceptionAllowsInsecureHTTPLoads

  • NSExceptionMinimumTLSVersion

但是,您似乎允许使用名为的新异常:

However, it appears you will be allowed to use a new exception called:


  • NSAllowsArbitraryLoadsInWebContent

这意味着 WKWebView控件仍然可以加载HTTP内容。不确定这是否也适用于UIWebView。

which means that a WKWebView control can still load HTTP content. Not sure if this applies to UIWebView as well.

在你的情况下,我猜你没有使用WKWebView,所以你最好开始研究你的合理的理由。或坚持使用iOS 8 SDK。

In your case, I'm guessing you're not using a WKWebView, so you'd better start working on your "reasonable justification". Or stick with the iOS 8 SDK.

这篇关于允许HTTP而不在iOS中禁用ATS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆