0

I have an iPad app that can come in several different releasable flavors, and I'm trying to decide how to best make these alternate releases. They have only a few differences source-code wise, and primarily differ in resource data files (xml and a very large amount of binary files).

1) Should I duplicate the project and branch the handful of source files and include the appropriate resources separately for each? This seems more of a maintenance hassle as I add files to the project and do other basic things other than edit shared files.

2) Or should I use #defines to build the appropriate flavor I want at any time, then ifdef out entire files accordingly? This seems simpler but my suspicion is that I won't be able to find an easy way to exclude/include resource files, and that would be a deal breaker.

Any suggestions on how to deal with the resource issue in option 2, or if there is an alternate approach altogether that is better?

Joey
  • 7,537
  • 12
  • 52
  • 104

1 Answers1

2

What about creating separate targets within a single XCode project?

Make each target include the files that are appropriate for that app; no need for ifdefs that way.

David Gelhar
  • 27,873
  • 3
  • 67
  • 84
  • Would I be able to do this with the resources in the project too? I.e. if i have 200 files in my resources that I want for proj 1 and 200 different ones for proj 2, can I specify which to include through the target config info? Do you know what this setting is? – Joey Dec 13 '10 at 02:21
  • Sure. Each target has its own list of files (sources, resources, libraries) that are to be included. You can control what files are in a target by dragging the files into the "Copy Bundle Resources" phase of the target. You can also see/change which files are included in the current target using the checkbox in the target (bullseye icon) column of the file list in the main project window. – David Gelhar Dec 13 '10 at 05:59
  • This worked great to get the separate targets building. I had tried using the user defined setting EXCLUDED_SOURCE_FILE_NAMES and it was causing issues excluding like-named files in different folders, but your approach worked out any kinks. However, I get this issue where building one target seems to fool the other target into thinking it's up to date. Should I simply alter the Build location settings "Per-config build products path" and "per-config intermediate build files path" to fix this, or did I do something wrong up to this point? – Joey Dec 13 '10 at 06:44
  • I just tried changing intermediate build path and I still get the file confusion when switching targets unless I touch the relevant files to trigger them updating. I can see the separate target.build folders forming, too, so it's puzzling why there seems to be a conflict. – Joey Dec 13 '10 at 06:59
  • Another issue is that both targets overwrite each other when I build it to my device. I gather I have to do something to make each distinct so they can show up as separate apps? – Joey Dec 13 '10 at 18:18