你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iOS9與XCode7中不克不及應用http銜接的疾速處理方法

iOS9與XCode7中不克不及應用http銜接的疾速處理方法

編輯:IOS開發綜合

在Xcode7.0及以上版本中編譯IOS APP時,默許會應用IOS9的一項新特征,使得一切http銜接被禁用,項目裡應用的API沒有https支撐,就喜劇了。差了官方文檔,有這麼一段話

App Transport Security
App 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文件可以持續應用http銜接,詳細的辦法以下:

1.在項目左邊找到Info.plist文件,可以經由過程Filter來搜刮


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


如許便可以從新應用通俗的http銜接了。不外有前提的話,照樣去弄一個https吧.

以上所述是小編給年夜家引見的iOS9與XCode7中不克不及應用http銜接的疾速處理方法,願望對年夜家有所贊助,假如年夜家有任何疑問請給我留言,小編會實時答復年夜家的。在此也異常感激年夜家對本站網站的支撐!

【iOS9與XCode7中不克不及應用http銜接的疾速處理方法】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved