I’m lazy – really lazy. So when I decided to create a free version of Converted, my first thought was: “How do I set this up so building the two versions and keeping them in sync requires no extra effort?”.

Since I’m no Xcode expert, it required some deliberation (and digging), but eventually I came up with a solution that fulfilled these requirements:

  • Both versions should be built from the exact same codebase; no branching or separate projects.
  • After the initial setup, building either version should be no more than a couple clicks; no edits whatsoever!

The solution hinges upon simply using 2 different Info.plist files. Apart from some Apple-specified keys that have to be set in each file, I also added (amongst others) a key for a boolean that controls the version (eg. XXIsLite). Within the code, the different functionality between the 2 versions is controlled by observing that boolean value.

Now normally, this solution is A Very Bad Idea™: a sneaky user of the trial version could just open up the bundle, change the key and gain access to the full version. On the iPhone however the bundles are signed, so this isn’t possible (I’m obviously discounting jailbroken iPhones that bypass the codesigning – anyone who goes to that much trouble to save a couple bucks is beyond help).

So here’s the process I followed, more or less:

  • In the ‘Groups & Files’ list, select your info dictionary file; by default, this is called ‘Info.plist’. Add a new line, set the key to something along the lines of ‘XXIsLite’ and the value to ‘NO’.
  • Again in the ‘Groups & Files’ list, expand the ‘Targets’ group. Right-click on the target that builds the app (in my case, Converted). Select ‘Duplicate’. Rename it if you like, eg. ‘Converted Lite’.
  • At this point it’s best to change the product name as well, so right-click on the new target and select ‘Get Info’. In the ‘Build’ tab, select ‘All Configurations’ from the configurations pull-down. Type ‘product name’ in the search box; change the ‘Product Name’ setting to something else, eg. Converted Lite.
  • Back in the ‘Groups & Files’ list, notice that Xcode has also duplicated your ‘Info.plist’ file and created ‘Info copy.plist’. Rename the new file to something else, if you like, such as ‘Lite-Info.plist’.
  • Setup the new info dictionary. At a minimum, you must change the bundle identifier to be different from the full version (com.codingcurious.ConvertedLite in my case) and set the value for the ‘XXIsLite’ key to ‘YES’.
  • Optionally, you can define a different home screen icon, a different display name or any other key-values you’d like to be different on the trial version.
  • Lastly, if you haven’t already, implement the code that will differentiate the trial version. Define certain “choke points” (the fewer the better) in your code where you check which version it is and modify or subtract certain features. For example, in the flip view Converted adds an additional “solicitation view” for the trial version that directs to the full version download page.

When you’re done, all you have to do to build either version is simply set the active target and build. This way, you can release updates for both the full and trial version with no extra effort at all!

Tip: when directing to the App Store, replace ‘itunes’ in the link with ‘phobos’; this will send the user directly to the App Store, without first launching Mobile Safari. For example,

http://itunes.apple.com/WebObjects/MZStore.woa/...

will first launch Mobile Safari and then redirect to the App Store, while

http://phobos.apple.com/WebObjects/MZStore.woa/...

will open the App Store immediately.

Posted on Thursday, January 29th, 20:12. Filed under: Converted, iPhone, Xcode