iOS iOS 9でHTTPモードを修正してネットワーク要求を行う

432 ワード

iOS 9にアップグレードしたら、デフォルトの要求タイプはhttpsです。httpを使って要求するとエラーが発生します。
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
ソリューション1:サーバをTLS 1.2に変更する
 
方案二:plistにhttpを使って要求を設定する
第1ステップ:plistにNSApTransport Security項目を追加します。これはNSDictionaryです。
ステップ2:NSApp Transport Securityに追加
NSAllowsArbitraryLoads   Boolean,value YES