Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

beachdog

macrumors member
Original poster
Aug 10, 2008
86
0
I have created an app, let's call it A, and now I want to create a new app, let's call it B, where B is a superset of A -- that is, B has everything in A plus some more. But I still want to maintain A as well. I could simply make a copy of A and then start adding the 'B' functionality, but then I would have to make fixes to 'A' functionality in both places. Can I configure my Xcode project to have two different targets, A and B, where:

- A and B have different main nibs
- A and B have different plist.info files
- A and B have different names
etc..

any tips from those who have done this would be appreciated
 

ace2600

macrumors member
Mar 16, 2008
71
0
Austin, Texas
It sounds like your problem's solution will be far simpler than what I'm about to describe (perhaps you're making a Lite and regular version of an app?), but this is how I handled shared code between my apps.

I chose GIT as my version control system because of its support for Submodules. Submodules allow you to share code between multiple repositories so that an update to the submodule in one project will update that code in every other project that uses that submodule (each repository must "opt-in" for each update). In your case, each app could be its own repository and the code shared between the apps could be a submodule so each app can always have the latest shared code. Or A could be a repository and a submodule for B.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Each target in a project builds a different binary. Each file in a project can be in one or more targets. If you're developing two apps that share a lot of code you can make them two targets in one project.

You should read the Xcode project management guide for the details.
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
It's easy to create 2 different targets in XCode, with 2 different product names, and 2 completely different sets (or partially overlapping sets) of source code and nib files. Use the little checkboxes in the XCode project group file browser to select and deselect different class and nib files for each project. Then edit the target settings for product names, & etc. You can also add target specific defines and use #ifdef's in your source code.

The problem seems to be with the Default.png, Icon.png, and Info.plist files. Renaming the icon file seems possible, but there may be reports that apps with renamed app icons have problems with uploading to the app store. Maybe a build script can be added to symlink or copy these 3 files into the project directory from a set of sub-directories before each build?


.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
If you have multiple files with the same name that you want to add to your project just put them in different folders. You can add them to your project and set the target for them so one goes to one binary and the other goes to another.
 

beachdog

macrumors member
Original poster
Aug 10, 2008
86
0
The problem seems to be with the Default.png, Icon.png, and Info.plist files.
.

I ended up adding a second target to my project, and that seems to have been pretty straightforward. When I added the second target, it also automatically added a new info.plist file for this target (named target-info.plist) and in that new plist I can specify a different main xib, a different icon, etc...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.