Is it possible to use precompiler commands for archiving?

Hi!


My iOS app has some constants


NSString * const PROJECT_DEFAULT_DOMAIN =@"http://www.project.com";

//NSString * const PROJECT_DEFAULT_DOMAIN =@"http://192.168.0.13:8080";


NSString * PROJECT_NEARBY_DOMAIN = @"http://www.project.com";

//NSString * PROJECT_NEARBY_DOMAIN =@"http://192.168.0.13:8080";


everytime, i am developing at home for new features, i am using the domain with my home ip. and if i am submitting the update, i am using the real domain.

even if iam submiting with a checklist, it happend sometimes, that i forgot to switch and had to reject my upload / which resulted in loosing time.


is there some possibility, to integrate some further, automated checkpoint? maybe i could use some precompiler statements which fire some actions if i am archiving the project?


thx

alex

Posted on Mar 2, 2013 2:18 AM

Reply
2 replies

Mar 2, 2013 3:38 AM in response to sommeralex

Hi,


Define a constant value in ".pch" file in the XCode files. And put a warning for reminding you to change it in future.



eg:



#warning Service URL need to change.........


#define kServiceURL @"http://192.168.0.13:8080"




And after adding this. Use this constant in all the places of the project in the case of creating it seperately. Hope it works for you.



---- Rajesh

Mar 2, 2013 7:18 AM in response to sommeralex

Create two, virtually identical targets, one for development and one for production. Set these strings to nil initially. Then, have two different source files, one for development and one for production, each having the same function with the same signature, where you assign the appropriate values to the strings. Associate only one source file with the appropriate target so that the function is only defined once. Then, in applicationDidFinishLaunching or similar, call your function to setup your strings appropriately.


I do this so I can have a demo build and an app store build. No #defines required.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Is it possible to use precompiler commands for archiving?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.