Some times you need to build two versions of your iPhone application(i.e lite and full version) from the same Xcode project. So one way is to make two copies of your Xcode project and manage both independently which is not a good way. Because when you have to change a little in your iPhone application, you have to change in both copies of your Xcode projects. So its not easily manageable for anyone to change a line of code in both codes of one application. So following this tutorial, you can make different applications from one source Xcode project!
Xcode is really a good IDE which provide lot of features. Everyday I come across to know more about Xcode features while building iPhone applications. So today I am going to share another most important feature of Xcode which helps you when you are thinking to create two iPhone application but with same project. So theme of this tutorial is to, create one application in Xcode and generator two builds(binary) form same code. In other words, you don’t have to manage two copies of your application. Just create one application and generator two copies of build(binary) files for apple store.
So let just start without going any further discussion. What I will do in this tutorial, create a project in Xcode and place three buttons on controller view. One button will display for lite version and two button will display on full version.
So lets start:
1. Create a “View-Based Application” project in Xcode and named it “HelloWorld” (figure 1–figure 2).


2. In your HelloWorldViewController.h file write the following code for linking with Interface builder (figure 3):
IBOutlet UIButton *buttonOne; IBOutlet UIButton *buttonTwo; IBOutlet UIButton *buttonThree;
3. Open HellowWorldViewController.xib file in interface builder and place three buttons on the view (figure 4). Now select three buttons and set there hidden property to true.
4. Now map those buttons with HelloWorldViewController class (figure 5).
5. Open HelloWorldViewController.m file and write down following code in viewDidLoad method ( I will explain this code later): (figure 6)
#ifdef LITEVERSION buttonOne.hidden = NO; #endif #ifdef FULLVERSION buttonTwo.hidden = NO; buttonThree.hidden = NO; #endif
6. Everything is setup for your code. Lets change few Xcode settings to make two binary(build) for our application. Expand Target from your “Group & File” side bar and right click on “HelloWorld”, select “Duplicate”.(figure 7)
7. Rename the duplicate file(HelloWorld copy) to HelloWorldLite (figure 8).
8. Now you will see “Info.plist” and “Info copy.plist” in your Resources folder (figure 9). Rename “Info copy.plist” to “InfoLite.plist” (figure 10). To check if everything goes right, select “HelloWorldLife” application from target and clicked on “info”(or right click on it and select ‘get info’ –figure 11) from Xcode. Please check that in configuration combobox “All configration” is selected and in show combobox “All settings” are selected. In search field type ‘info.plist file’ and it will show you the “InfoLite.plist” in value column (figure 12). (Do not close info window)
9. Now if you are in info screen, please type “product name” and change the value from “HelloWorld” to “HelloWorldLite” (figure 13).
10. Last step, Still info window is open. Clicked on bottom left of info screen “Add and edit build setting” (figure 14) and type “OTHER_CFLAGS” in “Setting” column and type -DLITEVERSION in value column (figure 15). Close info window.
11. Now select “HelloWorld” form target (figure 16) and right clicked on it to select “Get Info” (figure 17). Now bottom of this window, select “add and edit build setting” (figure 14) and type “OTHER_CFLAGS” in “Setting” column and type -DFULLVERSION in value column (figure 15).
Now its time to build full version for helloworld, select the build properties (figure 18) “Simulator – iphone os 2.0″ in Active SDK and in Active Configuration select “Debug” and in Active Target select “HelloWorld” (figure 18). Now clicked on build and go. See the result (figure 19)
Now to build for lite version of the helloworld, select the build properties (figure 20) “Simulator – iphone os 2.0″ in Active SDK and in Active Configuration select “Debug” and in Active Target select “HelloWorldLite” (figure 20). Now clicked on build and go. See the result (figure 21)
Final result will look like this (figure 22)
[update 21 April] You can download this code from here. (Thanks Ajay for reminding me
)
Popularity: 10% [?]























Nice tutorial to manage the multiple builds of single project.
great…. very helpful post… been wondering about this feature for some time. i am actually using it to show my client two different design options of the same app
Nice tutorial, would be be possible to upload / email-me the source code? It would be easier to play with it.
Thanks
Ajay
@gaith
Thanks for liking
@Ajay
thanks for reminding me. Please find the code link in this post.
Instead of OTHER C FLAGS we usually use “Preprocessor Macros” (GCC_PREPROCESSOR_DEFINITIONS), but I don’t know that it’s any better.
Question – how do I handle things like Localizable.strings and InfoPlist.strings. You can’t have two copies of these files and there is no info.plist setting I can use to target the correct file with a different name. Plus how would one handle different Default.png for each target?
@Michael,
Please check my latest post and grab the code. I hope this helps you.
Very good tutorial, but the images won’t show up!
first let me appreciate you for this great tutorial.
Out of scope,I need to know how we can create a group dynamically(runtime) in to the same project.
thanks in advance..
If I have a tab bar controller, how can I hide one of the tab bar items for lite version?
Reupload the images and code please