iOS9中的应用传输安全性和IP地址 [英] App Transport Security and IP addresses in iOS9

查看:89
本文介绍了iOS9中的应用传输安全性和IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在我的开发箱上运行的本地服务器开发iOS应用.在设备上进行测试时,我直接通过一个IP地址进行连接,该IP地址是通过HTTP而不是HTTPS进行的(因此,在开发过程中,我不必处理自签名证书,无论如何,该设备都不会).

I develop my iOS app using a local server running on my dev box. When testing on devices, I connect directly via an IP address, which is over HTTP and not HTTPS (so I don't have to deal with self-signed certs while in development, which the device wouldn't even like anyways).

我认为这足够了:

但是,如果不添加NSAllowsArbitraryLoads = YES也无法使其正常工作,又叫这个:

However, cannot get it to work without also adding NSAllowsArbitraryLoads = YES, AKA this:

现在,我将必须记住在滚动生产版本时将其删除,但在开发过程中则不要... arg. NSExceptionDomains是否应该使用IP地址,否则,是否可以在不启用NSAllowsArbitraryLoads的情况下做其他事情?

Now, I will have to remember to remove this when rolling a production build but not during development...arg. Should the NSExceptionDomains work with IP addresses, and if not, is there anything else I can do without also enabling NSAllowsArbitraryLoads?

推荐答案

硬编码的IP地址无法在iOS9中使用.我也面临着同样的问题. 尝试了所有排列和可用解决方案的组合. 最后,必须使用正确的域名.

Hard-coded IP address wont work in iOS9. I also faced the same issue. Tried all permutations & combinations of available solutions. Finally, had to use a proper domain name.

因此,不能.在iOS9中,您只是无法摆脱硬编码的IP地址.

So, NO.In iOS9 you just can't get away with hard-coded IP addresses.

这篇关于iOS9中的应用传输安全性和IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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