Managing One Xcode Project with different Teams/Bundle IDs
Normally when developing an enterprise level application we need to maintain at least two profiles for internal builds and client builds. That is the normal practise. Sometimes it may grow further for alpha, beta testing also. Then developers need to share builds on different Apple developer accounts and keep track on different Versions and Build numbers. Therefore keeping different Bundle IDs and Build numbers in a single target is cumbersome. Solutions is managing different Schemes for development, staging and productions and so on as needed. Let’s see how we can manage different Schemes and Targets for a single project.
Following screenshot shows how you see the normal way initially
Here it has only One Target and also One Scheme only. My requirement is to manage this app in two different Teams. So obviously it needs two Bundle identifiers.
First right click on the target and press Duplicate. Here you can rename the target as you wish. (select target and click again after a while to rename)
Now duplicate your Info.plist and rename as you wish. (Option+Click and Drag and Drop to duplicate)
Now try to build the project. You may get an error because you renamed the file. We have to fix it in the particular target.
As above find the Info.plist file path and rename. Here When you select Dev Target change Info.plist file path as Dev. For Prod change accordingly in the particular target.
Now we are going to change the Teams and Bundle Ids for two Targets we created. Following image shows the configurations for Dev Target.
Following image shows the configurations for Prod Target.
Now we have done almost all the work. Next we have to create two Schemes to complete the task
Now go to Manage schemes.
Product -> Scheme -> Manage Schemes
Here click on add (+) to add a new scheme. There you can select the Target (what you created in the previous step) as you wish to add to the creating Scheme. Here is how it looks like.
As above create to Schemes for the two Target we created for Dev and Prod. Now you can select the auto created two schemes and click on (—) to remove them.
Now you are done with creating two Schemes for two Targets we needed to create with different Teams for the same project.
Change the Scheme and build with same Simulator at two instances. Now you can see there are two apps created in the simulator. So it confirms that we have created to schemes.
Further you can keep configurations, Urls separate for two schemes. We’ll discuss it in another article.