Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build different versions of apps with different skins/branding?

Tags:

xcode

ios

I am creating a generic app which will have different builds for different customers. The app is 99.5% identical for each customer, the difference being each is branded with the customer's own particular images and text and app icon etc.

Obviously this could be done using flags such as:

#if defined (CUSTOMER_A)
    NSString* text = @"Text for customer A";
    UIImage *image = [UIImage imageNamed:@"customerAImage"];
#elseif defined (CUSTOMER_B)
    NSString* text = @"Text for customer B";
    UIImage *image = [UIImage imageNamed:@"customerBImage"];

But obviously I'd like to avoid this and just have:

   NSString* text = @"Text";
   UIImage *image = [UIImage imageNamed:@"image"];

(The text would be localizable, so it would be using NSLocalizedString in the final version).

I was wondering if a possible approach would be to place the project into a workspace along with a number of static libraries, each of which contains the specific text and images for each customer and then use different schemes to create different builds. So Scheme A would create a target built with the main project and static library A for example.

I started with a small proof of concept but before going too far with it I'd first like to check this is a feasible and reasonable approach, or if there's a better alternative. If it is feasible then a few questions come to mind:

  • how can an image in a static library be accessed from the code in the main project? Does a bundle have to be created to access the contents of the library, how is this done?

  • is it possible to change the application desktop and marketplace icons depending upon which scheme is used?

  • is it possible to specify a different set of distribution certificates etc. to be used per scheme?

  • is it true that static libraries cannot contain localized variants?

This is for iOS so its not possible to use a framework for this.

Thanks for any feedback.

(P.S. the build system will be automated using Jenkins).

like image 337
Gruntcakes Avatar asked Jul 31 '12 22:07

Gruntcakes


People also ask

What is a branded mobile app?

A branded app is a mobile application created by a company to promote its brand. Branded apps typically reflect the brand's identity and feature its values, colours, logo, visual identity and style, slogan, and more.

What is a mobile app branding and why is it important?

So, mobile app branding is how users will perceive the app interacting with it: its visual image, its communication, and its reputation.


2 Answers

You just need to create multiple targets in your project and have resource folders for each target (customer/brand). Here's how to accomplish this:

  1. Create two new Resource Folders a. Resources_Customer1 b. Resource_Customer2
  2. Copy the appropriate resources into the respective folders
  3. Select Project -> Targets
  4. Duplicate the Target
  5. Customize the Resources Name in [Copy Build Resources] so that it points to the appropriate
    customer/brand
  6. Test and Verify the appropriate Target runs based upon the Target selected.

Hope this helps!

like image 91
Native_Mobile_Arch_Dev Avatar answered Sep 29 '22 16:09

Native_Mobile_Arch_Dev


How many variants do you plan on supporting? Having a target/project/etc becomes unwieldy if you have more than a handful. This is roughly what we do:

  • Jenkins monitors the source control and builds any new commits it sees.
  • Jenkins archives the output .app along with a collection of "skins"
  • A home-brewed website hooks into the Jenkins API and lists all the permutations of (branch, skin).
  • The "user" selects a (branch, skin) and the home-brewed site calls a script that "applies" the skin to the .app bundle, signs it and packages it into an .ipa that is then installed to the user's device.

The skin "application" process basically consists of providing a list of "skin" directories, which are files to be copied into the application bundle. Any duplicate files are overwritten by the skin. The application's base Info.plist is merged with any changes specified in the skin directory.

Essentially, we try to separate out the skinning as much as possible from the code itself. We have found that any solution involving Xcode itself involves much manual self-removal of hair from developers' scalps.

like image 26
Sedate Alien Avatar answered Sep 29 '22 15:09

Sedate Alien