LoginSignup
32

More than 5 years have passed since last update.

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

Last updated at Posted at 2015-10-15

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を書き換えるようにしてる。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32