LoginSignup
0
0

More than 5 years have passed since last update.

xcode10 でschemaを切り替える方法

Posted at

やりたいこと

STAGINGの分岐をできるようにする。ちなみにDEGUBとPRODUCTはそもそも設定されています。

#if DEBUG
 NSLog("DEBUG")
#elseif STAGING  ←ここ
 NSLog("staging")
#else
 NSLog("else")
#endif

やり方

  • メニュー > Product > Schema > new Schema.. を選択する
  • 任意でスキーマ名をつける (例:projectname-staging)
  • project > Info > Configurationsを選択して、+を押し、Debugをコピーします
  • スクリーンショット 2018-10-18 18.31.21.png
  • コピーしたDebugのNameをStagingにします
  • スクリーンショット 2018-10-18 18.35.59.png
  • TARGETS > Build Settings > Active Compilation Conditions のstatingの値がdebugになっていると思うので、statingに変更します
  • スクリーンショット 2018-10-18 18.42.10.png
  • メニュー > Product > Schema > edit Schema..を選択する
  • Build ConfigureをStagingにします
  • スクリーンショット 2018-10-18 18.45.03.png
  • あとは実行ボタンを押して、「staging」がログに出れば成功です
  • 今後は、schemaを切り替えるだけで、環境を切り替えられます

   

0
0
0

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
0
0