Our Story

Enterprise solutions to empower people.
Company was established in the year 2012. Provide high quality cost effective services to the community and businesses. Goldenmace is a company with young, energetic, curious and committed minds who are excited about solving complex business problems, ethically. We build long term relationships and provide quality products and services that will exceed the expectations of all our customers. We deliver secure, reliable and scalable applications that help businesses excel in today’s rapidly evolving economy.

Working Hours

Monday to Saturday ................. 09:00 - 18:00

Sunday ......................... CLOSED

info@goldenmace.com

IND +91 22 4004 9616 | USA +1 309 247 5034

Top
 

How to create multiple targets for XCode iPhone app

How to create multiple targets for XCode iPhone app

It’s important to understand why and when you might need multiple targets. As an app developer, you would like to release a given app using a new brand name, logo and/or theme, along with some minor feature differences. Using multiple targets concept, you can maintain app very quickly.

In this blog, you will learn how to set up multiple build targets, manage icon, assert which are unique to each target. So let’s first understand what is target?

 

What is target?

Apple describes targets as follows:

A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. A target defines a single product; it organizes the inputs into the build system—the source files and instructions for processing those source files—required to build that product. Projects can contain one or more targets, each of which produces one product.

 

To create a multiple target, you need to follow below steps:

  1. Create a new target
  2. Update Info.plist file for selected target
  3. Managing Resources file (image, icon, splash image)
  4. Define theme for your target(optional)

 

1.Create a new target

Let’s assume we have an application called “XYZ”, which is a paid version. And we would want to create a free version and promotional version of that has some reduced functionality but is free and promotional offers respectively. It is to note that all three versions would share the same code, with only some differences and apps’ app-icons and splash images
are different.

First create new target. Under Targets and select your project and right click and duplicate target create.

2. Update Info.plist file for selected target

We could define properties, such as application name and icon files, for each of the target.

3.Managing Resources file (image, icon, splash image)

You could copy different resources (having same name but different) to the targets. Resource could refer to xib files, images, etc.

For example, if the free version has a different default loading screen, you could create another Default.png for the free version. Note: To make it work, you have to copy the correct Default.png to that target’s “Copy Bundle Resources”, and also to remove the incorrect Default.png.

4.Define theme for your target(optional)

writing code in app delegate.

NSString* color=[[[NSBundle mainBundle] infoDictionary] objectForKey:@”CFBundleName”];

if ([color isEqualToString:@”free”]){

NAV_COLOR_RED=24; NAV_COLOR_GREEN=88; NAV_COLOR_BLUE=149;

ASENT_COLOR_RED=24; ASENT_COLOR_GREEN=88; ASENT_COLOR_BLUE=149;

}

else if([color isEqualToString:@”paid”]){

NAV_COLOR_RED=255; NAV_COLOR_GREEN=1; NAV_COLOR_BLUE=27;

ASENT_COLOR_RED=255; ASENT_COLOR_GREEN=1; ASENT_COLOR_BLUE=27;

}

else if([color isEqualToString:@”promo”]){

NAV_COLOR_RED=255; NAV_COLOR_GREEN=1; NAV_COLOR_BLUE=45;

ASENT_COLOR_RED=255; ASENT_COLOR_GREEN=1; ASENT_COLOR_BLUE=45;

}

]

 

The code and the examples shown in this article are available at Github Repository

No Comments

Leave a Comment