Different Builds for the same application - ios

I am developing a product for a client and I have a problem.
The application will be sold to various customers only changing the interface the same (images - images.xcassets).
What is the best way to manage this? I do not want to duplicate the project for each client, but a way to manage builds of each, and the only change will be the bundle id and images.
My project is IOS 6.1>
Thank you.

As Wain says, set up multiple build targets. Select your project in the navigator area, then select the current target in the list of targets, right click on it, and select "duplicate". That will create a new target that does exactly the same thing.
You'll need to change the bundle ID, app name, etc.
Then you would select your current asset catalog, select the view menu>utilties>file inspector and set the target membership to just the current target. Select your new target, add a new asset catalog, and set it's target membership to only include the file in the new target.
Repeat this process for each version of the app that you want to build.

Related

Using a single xcode file for multiple projects

I haven’t tried this before but wanted to know how it happens. Suppose I have an Xcode file for my project called ‘Project A’. Now I want to make another project with the same features as that of ‘Project A’ for a project called ‘project B’. But for ‘project B’, I don’t want to make a different Xcode file but rather want to incorporate the changes in ‘project A’ itself so that when I run the same project, I’ll be able to run project A or project B as per my need. How can I achieve this…?
Click on your project, Goto General > Targets.
Right click on your project Target and select Duplicate.
You will get to choose between iPad and continue to duplicate for iPhone.
Going ahead in each new/existing file, you can choose which target it belongs to and keep doing your development. If you exclude the file from an target, it will not contribute to that app's size.
You can also keep your future files in both Targets depending on your needs.

Use different packages for different builds iOS

I have a package named assets where I store my database and media files. I want to publish my application and use source control, but I need to use different assets for each publication. How can I achieve that in xcode ?
Create different Targets for the builds you need (right click on a target and duplicate it is the easiest way ) then change the Target Membership of the assets required for the specific targets you need ( target membership can be seen on the right hand pane when you select an asset and this will give you the ability to checkbox assets against the Targets )

How to manage multiple projects in single project copy in iOS?

We have projects which are same for all the cities now I want to make those project in one project, so I can do a change in single project and effected in each.
You need to create one different target for every city, on the same project.
They will have the same core code and then, you can configure different ressources for all of them. (icons, images, fonts ...)
Each of them can use a different plist file in order to have some flags and not others.
To create a new target :
* Go to your project panel (with tabs General - Capabilities - Resources tag ...)
* Open the left panel
* There is a + at the bottom to create your new target (or you can copy an existing one)
You can switch from a target to another on the top bar at the right of the selected device to debug
When you have a file, you can decide on which target he can go on the right panel on the section "Target Membership"
Need screenshots ?
Very nice explained with pictures is here.
You can achieve it by using targets in Xcode.
As well here is explained about targets.

What is the best way to have multiple variations of a product in Xcode?

I have a project that I maintain for a client; let's call it MyDataAssistant. When the project goes into beta, the client likes to have a "separate app" built for them, which I create using a different provisioning profile and a modified bundle identifier (MyDataAssistant-BETA). It's a pain to always be going back and forth and changing the bundle identifier, code signature settings, and especially the icon. I understand that you can have multiple targets and multiple build settings (within each target?) in a project, but I'm not clear on what the difference is, or how to use them appropriately.
Additionally, the client would like a third version with read-only capabilities. I can accomplish this by just making a flag return from a certain part of my code, but I would like it if that flag could be toggled in the build (target?) settings.
Please advise on how to manage this kind of project with multiple "variations" of the build.
Add a new configuration to your project by duplicating the release one for example.
Give it a name "Beta"
Add a User-defined build setting
Call it MY_DATA_ASSISTANT_BUNDLE_ID_SUFFIX for example and set the value to be -BETA only for the Beta configuration.
Edit the MyDataAssistant-info.plist file by setting the bundle identifier to com.YOURCOMPANYNAME.MyDataAssistant$(MY_DATA_ASSISTANT_BUNDLE_ID_SUFFIX)
This will make it have different values for the different configurations.
You can also set the display name to have a different value by setting it to $(PRODUCT_NAME)$(MY_DATA_ASSISTANT_BUNDLE_ID_SUFFIX)
Set the right provisioning profile for each configuration. (Of course after creating the beta one in the provisioning portal as if it was for a new app with the bundle identifier having the suffix "-BETA")
Create a new scheme!
Give it a name: MyDataAssistant-BETA
Change its build configuration to "Beta" for all the actions and you should be ready to go.
If you want to have different icons for the beta version you can use the $(MY_DATA_ASSISTANT_BUNDLE_ID_SUFFIX) in the MyDataAssistant-info.plist file for the icons names and of course add them to the target.
I would recommend creating two targets. This will allow you to share what files you want between variations, as well as have custom source, or config files in each. The simplest implementation of this would be to have an identical target except for the info.plist file.
Simply right click on your current app target in project settings, and hit duplicate.

How can I change the name of an iOS app in Xcode?

I began an iPhone project the other day with a silly development code name, and now I want to change the name of the project since it's nearly finished. How can I do this?
Go to Targets in Xcode.
Build Settings on your project's target (your current development name).
Search for Product Name under Packaging. Change its value to what you want your new project name to be.
In new versions of Xcode (Xcode 5 too), to change the name of the project, follow these simple (detailed as possible) steps:
Note: In this example I'll change a hypothetical "Sample" name to a "Test" one.
Click twice slowly on the project root in the project navigator and then it becomes editable.
Rename the project.
After pressing Enter the assistant will suggest you to automatically change all project-name-related entries and will allow you to de-select some of them, if you want.
Press 'RENAME' and Xcode will do the rest. In the meanwhile Xcode may ask you about the option of making a snapshot of the project (it is very recommendable to do so).
In addition to renaming the project, you may want to rename the scheme so that it matches your new project name.
Repeat similar steps like 1 and 2, and press OK.
That's it.
Another scenario...
The previous explanation was related to changing the project name, but chances are that you only need to change the display name that appears below the app icon in the home screen. These are the steps:
In the "Supporting Files" group locate the info.plist (or related) file
Locate the "Bundle display name" key and change the value to the new name.
Delete the "old" app from the simulator or any other testing device.
Clean and rebuild your app again.
That's it. You will now see the new app name in your home screen.
You change the bundle display name in the info.plist file. It's as simple as that.
Changing the 'bundle display name' (as opposed to 'bundle name') is the only way to include characters like '+' in your applications name. Including special characters in the project name will cause an error when uploading to App Store!
In Xcode 4 search for "Product Name" under "Build Settings" tab of the target.
Select Target
Select Info
Insert Bundle Display Name and set App Title
If you want to change the display name only then you can directly change it in the property file (plist) of the app.
You can add a new row with the following key: Bundle display name
Here is an example for this:
When you use this the app name, which you have given with this key, it will be displayed.
So you can do this simply.
This is how I changed it in Xcode 4:
Click on your target file (the first main file of the application).
Go to Build Settings.
Scroll down you will find a bar called "Packaging".
Under Packaging you will see Product Name, and you can change the project name.
In Xcode 3.2, just select the Project entry in the Groups & Files panel, and select the menu item Project → Rename… It worked for me.
Xcode 7/8? It's in the plist that your target uses
For Xcode 10.2:
Although this question has many answers but I wanted to explain the whole concept in detail so that everyone can apply this knowledge to further or previous versions of Xcode too.
Every Xcode project consists of one or more targets. According to apple, 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. So every target is a product (app) on its own.
Steps to change the name:
Step 1: Go to the Targets and open the Info tab of the target whose name you want to change.
Step 2: View the Bundle name key under the Custom iOS Target Properties that is set to the default property of $(PRODUCT_NAME).
Step 3: You can either change the Bundle name directly (not recommended) or if you open the Build Settings tab then on searching for Product Name under Setting you will see that Product Name is set to $(TARGET_NAME).
Step 3A: You can change the Product Name or you can also change the Target Name by double clicking on the target.
So changing the Product Name (App Name) or Target Name both will result into similar results. But if you only want to change the App Name and want to keep using the same Target Name then only change the Product Name.
From Xcode 4.2 and onwards, you can use one more option.
Just click once on the .proj file name at the top in left navigation pane and it will be available for renaming. Rename it and the whole project will get renamed and not only the target.
For Xcode 11, if you want to change the App Display Name then simply go to plist and simply replace the value of CFBundleDisplayName:
<key>CFBundleDisplayName</key>
<string>Your App Name</string>
The best way I like in Xcode 5 is to change product name in building settings. Search "product name" in "building settings", and change it.
If you need to change the name of the application as it appears on the iPhone's home screen, you need to do it in the Target configuration, not the project configuration.
Expand the Targets group in Xcode, and then single-click the item under that. It should share the name of your project, which is also the default name of the application that gets generated.
Press Command + I to bring up the Info window, and then navigate to the Build tag.
Set the Configuration drop-down to read All Configurations.
Look for a setting called Product Name under the Packaging heading.
Change that value to the name you want for your compiled applications and, in the immortal words of Bugs Bunny: Voilà! Do a clean and a build. Your application will take on the new name.
If you want to change the name, that will be displayed on your screen, right under your icon, in Xcode 4, go to Targets → Info → Bundle Display Name and change it to whatever you want.
In Xcode 4 click on project name to start renaming.
It's very easy to change in Xcode 8. enter the app name in the "Display Name" field in Project Target → General Identity section.
Also: your target name may be the same as your app name - note that changing the target name does not change the app name - only the change in the target properties described below - will change the app name.
A note on the bundle display name -- this is the right way to change the name in your app menu, but you'll likely have to reset content and settings in your iOS simulator before you see the change actually take effect.
You can modify the Product Name without changing your Project Name (especially the directory).
Build Settings > search the keyword "product name" > update values
For the sake of gathering all relevant information in one place, here is the official answer to this question - and it is the only one that worked for me on Xcode 5.1.1
Just use the Identity and Type pane in Xcode.
Select the top-most line to the left (with your project name, number of targets, etc.).
Select the target you wish to rename.
Click on the name of the target again.
Type the new name.
Press Enter.
For changing the application name only (that will display along with the app icon) in Xcode 4 or later:
Click on your project file icon from Groups & Files panel, choose Target → Build Settings → Packaging → Product Name. Click on the row. A pop-up will come. Type your new app name here.
For changing the project name only (that will display along with project icon) in Xcode 4 or later:
Click on your project file icon from the Groups & Files panel, choose Project (above targets) from the right pane. Just see at the far right pane (it will be visible only if you have enabled "Hide or show utilities"). Look for the project name. Edit it to a new name you want to give your project.
Delete your app from simulator/device, clean and run. Changes should reflect.
That's it.
I saw many ways to change your app name on the home screen, and I don't think the necessity of edit your .plist file or changing Build Settings of target is justified.
By default in Xcode 7.2 you even don't have 'bundle display name' in your plist file.
And by default, your 'Product name' in 'Build settings' tab of your target is equal to $(TARGET_NAME). IMHO, it's convenient and didn't mean to change.
So you can simply change your Target name like hallski said in his comment for accepted answer. I made picture for it:
I think there is a bit of confusion:
Do you want to change the project name or
do you want to change the App name on the iOS dashboard?
Usually it is enough to change the latter, adding/modifying the BUNDLE DISPLAY NAME key in plist.
It is better to leave the project name untouched, but it may be changed.
Note that Bundle display Name can contain spaces and special characters, but project not. Doing so some cmd line tools will fail due to filename path rules.
And even more Bundle Display names can be localized.
So unless you are in early stage and need to change the internal project name, go on using the Bundle Display Name key.
Project Navigator → General → Display Name
There are
Product name ($(PRODUCT_NAME)): defaults to Target name. This is useful for scheme to select the right target
Bundle display name (CFBundleDisplayName): defaults to Product name. This is what is displayed to your iOS user
Follow these four steps maintaining serial no. And in step 4 give your desired name..
The easiest way: select the TARGET name, double click on it, and rename.
You'll see your app's new name underneath the icon on your device or simulator.
Using Javier's approach to rename my app works perfectly. There is just one small bit missing in the end that I wanted to add.
I still ended up getting a Mach-O Linker Error after a clean and rebuild. To resolve this; select yourProject (in the Project Navigator). Under Targets, select yourProjectTests (the test target) → under the General tab, update the Host Application's value to the newly renamed project.

Resources