1

I'm developing an iPad application that will be distributed "in-house" ie only inside enterprise. They asked me if i can produce 2 different releases of the same application to be installed on the same iPad.

The first one will communicate with a production server while the second will use a sandbox server and will be used by user to learn the system. Server url will be changed in app settings.

They told me to differentiate these releases by icon and title (and also, of course, by title in navigation bar). What's the best way to get this goal avoiding duplication of the project?

giampaolo
  • 6,906
  • 5
  • 45
  • 73

1 Answers1

2

It sounds like you have 3 variables:

  • API address
  • Name
  • Icon

One idea might be to add a separate build configuration, call it something like "Sandbox". Here's an example of how to create a new build configuration. Then, have two separate Info.plist files specifying the "Bundle display name" and "Icon files". Copy your existing Info.plist and name it something like "Sandbox-Info.plist".

Then, in your project's settings, select the target (on the left) and the "Build Settings" tab. Search for "Info.plist File", and expand it. For the Sandbox entry (the name of build configuration you set earlier), change this entry to the Sandbox-Info.plist file you created.

This covers the name and icon settings. For the API address, search for "Other C Flags" in the "Build Settings" tab. Expand it. For each row, add a value like:

-DAPI_URI=@\"http://api.example.com\"

Vary this for the Sandbox entry to whatever your sandbox URI is.

Lastly, in your code, refer to API_URI as the string to your API address.

Hope this helps!

Community
  • 1
  • 1
sigre
  • 371
  • 1
  • 8
  • I could be wrong but I think you may also need a different App ID, so both apps can be both installed on the same device. – Bill Wilson Jul 05 '12 at 00:09
  • @Ryan: It worked well, thanks. Also Bill's indication is needed to satisfy the requirement of both apps on same device. But I have one more question. What is I want API_URI also in app settings so that user can change the default i provide? – giampaolo Jul 05 '12 at 23:11
  • @trapo That's a different question and a bit more involved than I can do justice in a comment. To get you on the right track, check out iOS Settings Bundles. – sigre Jul 06 '12 at 02:20
  • you are right, going to check that, and eventually do another question. thanks. – giampaolo Jul 06 '12 at 05:47