提高App Transport Security的例外情况? [英] Raise exception on App Transport Security?

查看:164
本文介绍了提高App Transport Security的例外情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS 9下,我在这里使用了接受的答案:运输安全已阻止明文HTTP

Under iOS 9, I've used the accepted answer here: Transport security has blocked a cleartext HTTP

我将条目添加到 NSAppTransportSecurity 下的Info.plist文件中。我的应用程序似乎运行正常,以及执行我已经考虑的所有请求。我仍然收到错误:

I added the entries to my Info.plist file under NSAppTransportSecurity. My app seems to be functioning properly, as well as executing all of the requests for which I've accounted for. I am still receiving the error:


App Transport Security阻止了一个明文HTTP(http://)资源
加载这是不安全的。临时例外可以通过
配置您的应用的Info.plist文件。

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

我的问题是我无法找到在我的应用程序代码库中,这是来自,我不想允许所有域(在我接受的答案中引用的懒惰选项)。有没有办法为它引发异常,以便找到警告的来源?

My problem is that I can't find where in my app codebase this is coming from and I do NOT want to allow all domains (lazy option referenced in the accepted answer I credited). Is there a way to raise an exception for it so that I can find the source of the warning?

推荐答案

使用此链接( http://timekl.com/blog/2015/08 / 21 / shipping-an-app-with-app-transport-security / )我发现将环境变量 CFNETWORK_DIAGNOSTICS 切换为 1 生成所有请求的详细日志。

Using this link (http://timekl.com/blog/2015/08/21/shipping-an-app-with-app-transport-security/) from the comment above, I found that switching the environment variable CFNETWORK_DIAGNOSTICS to 1 produces a detailed log of all the requests.

这使我能够跟踪来自webView的请求加载我自己的域名,然后加载MixPanel和Google Analytics等内容。将这些域输入Info.plist文件可以解决问题,但是,我们只需要加载这些库的https版本。

This allowed me to trace the requests coming from a webView where I'm loading my own domain, which in turn loads things like MixPanel and Google Analytics. Entering those domains into the Info.plist file fixes the issue, however, we're instead simply going to load the https versions of these libraries.

这篇关于提高App Transport Security的例外情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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