33
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at

iOS9でDebugビルドのみATSを無効化する

Run Scriptに以下のような処理を追加すればいい。

if [[ $CONFIGURATION == "Debug" ]]; then
    defaults write ${TARGET_BUILD_DIR}/Debug.app/Info.plist "NSAppTransportSecurity" -dict-add NSAllowsArbitraryLoads -bool yes
fi

Debugでビルド時はlocalhostに立てたAPIサーバと通信させたい時など、特定のconfigurationのみhttp通信を許容したいとき便利。

Info.plistの設定項目をconfig毎に切り替えるのは環境変数を使う手があるけど、設定の値がString型になってる必要がある。なのでビルド成果物のコピー先でplistを書き換えるようにしてる。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
33
Help us understand the problem. What are the problem?