I should built and archive my application with Prod_URL and Stage_URL for our test team.
now i am using an Constant.h
file and there is a code like;
//for stage
#define SERVICE_URL @"myStageUrl.com"
/*
//for prod
#define SERVICE_URL @"myProdUrl.com"
*/
And I always changing comment out lines to be able to build two different version of my app.
So now I wanna do it automatically.
I create two target like MyAppStage and MyAppProd. And I think I should write a Run Script for that to switch between these two #define
lines. But I don't know how to write script.
Or are there any better way for that situation?
Thx,
If you have two separate targets you can place these defines in the project properties its self. To do that you go to your project properties. Click on the target you want to edit, click on the "Build Settings" tab and search for Preprocessor Macros. Define anything you want there and it will be visible for every class in that target.
Another option is to use the same Preprocessor Macros build setting and set a macro for STAGE
. then in your Constant.h you can have something like:
//for stage
#ifdef STAGE
#define SERVICE_URL @"myStageUrl.com"
#else
//for prod
#define SERVICE_URL @"myProdUrl.com"
#endif