国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > iOS > 正文

iOS9與XCode7中不能使用http連接的快速解決辦法

2020-07-26 03:08:02
字體:
來源:轉載
供稿:網(wǎng)友

在Xcode7.0及以上版本中編譯iOS APP時,默認會使用iOS9的一項新特性,使得所有http連接被禁用,項目里使用的API沒有https支持,就悲劇了。差了官方文檔,有這么一段話

App Transport SecurityApp Transport Security (ATS) enforces best practices in the secure connections between an app and its back end. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt; it is also on by default in iOS 9 and OS X v10.11. You should adopt ATS as soon as possible, regardless of whether you're creating a new app or updating an existing one.If you're developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible. In addition, your communication through higher-level APIs needs to be encrypted using TLS version 1.2 with forward secrecy. If you try to make a connection that doesn't follow this requirement, an error is thrown. If your app needs to make a request to an insecure domain, you have to specify this domain in your app's Info.plist file.

在這里面可以看到,通過修改Info.plist文件可以繼續(xù)使用http連接,具體的方法如下:

1.在項目左側找到Info.plist文件,可以通過Filter來搜索


2.在右側點擊Add Row添加NSAppTransportSecurity,類型為Dictionary,然后再添加子項目NSAllowsArbitraryLoads類行為Boolean值為YES


這樣就可以重新使用普通的http連接了。不過有條件的話,還是去搞一個https吧.

以上所述是小編給大家介紹的iOS9與XCode7中不能使用http連接的快速解決辦法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網(wǎng)網(wǎng)站的支持!

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 洛阳市| 涟源市| 丽江市| 高尔夫| 顺昌县| 定西市| 博爱县| 攀枝花市| 龙口市| 嘉禾县| 新和县| 龙胜| 恭城| 桑植县| 嵊州市| 卢湾区| 黑山县| 城市| 民丰县| 东乡县| 临猗县| 收藏| 新绛县| 隆昌县| 行唐县| 郑州市| 蓝山县| 衡阳市| 璧山县| 同仁县| 宾阳县| 垫江县| 杭锦旗| 阜平县| 治多县| 高密市| 南充市| 广宁县| 拉萨市| 河西区| 兴安盟|