How to add new iPhone target How to add new iPhone target xcode xcode

How to add new iPhone target


In xcode 4, make sure you're in the folder view where you have the project. Select the blue project button, then next to that you can see Targets, Select the target you have there, right click & select duplicate target.

Now you have two build targets.

To apply subtle differences in your app, make a global C flag. in Build settings there is a paragraph named GCC 4.2 - Language, it has a property named Other C Flags. Add your flag here like so:

-DOTHER_VER

Now in your code you can check for this using:

#ifdef OTHER_VER    // some code.#else    // the subtle difference.#endif


After you create your new target from settings of your project, you can create an identifier class to check the target. If you use macros everywhere in your code, it'll not be readable and feasible. You can check this tutorial-blog to learn how to do it, besides you may see some best practices there.