skyshine
skyshine

Reputation: 2864

How to write different script for Debug and Release Builds Xcode IOS

I am integrating crashlytics for android and ios apps for android using build flavor we can give separate organization key but in ios debug and release scheme i need to run different script because i need to provide different keys to that project.

script

    "${PROJECT_DIR}/Fabric.framework/run" 834343231341432432432432432408497cdbfa13ceb728b296e1c595557bb8c389a33693f150f

Upvotes: 1

Views: 2777

Answers (2)

Fares Benhamouda
Fares Benhamouda

Reputation: 619

There's many options for build confg in iOS as well depending on your project.

You could use configuration files : xcconfig

  • 1 : Create a new xcconfig file ( base.xcconfig) with the following :

    KEY = YOUR_DEBUG_KEY

  • 2 : Create a release config file ( release.xcconfig) :

    KEY = YOUR_LIVE_KEY

  • 3 : Set the newly created files in project settings :

enter image description here

  • 4 : In the Build Phase :

    "${PROJECT_DIR}/Fabric.framework/run" ${KEY}

Another simple way to do it ( if something needs to be changed in the code itself) :

#ifdef DEBUG
   // debug config
#else
   // release config
#endif

Upvotes: 3

NikLoy
NikLoy

Reputation: 448

You can edit your sheme to add a script for each configuration.

EDIT: You click on your scheme -> Edit Scheme... -> Click on Build Arrow -> Pre/Post actions -> + -> New Run Script Action

Upvotes: 2

Related Questions