If you find yourself in the position where having multiple targets in your iOS project would be useful: for instance you wish to make a production, staging and demo target with separate endpoints, then this guide should prove useful.
- Start by opening your project in xCode 6 and clicking on your project header to display the existing targets.
- Duplicate an existing target (preferably the original) and rename it (e.g "app_name production")
- Navigate to this target, then build settings > packaging> product name. You will see "app_name copy". Change this to
- Right click on any folder in your project and go to Finder. make a new folder inside the project structure with a similar name to your target (e.g production)
- Copy the config file, info.plist file and any other files you wish to be unique to this target into the folder
- Drag this folder into your project in xCode to add it to the project bundle.
- Click on the new info.plist file and make sure that no target membership is ticked in the right sidebar.
- Delete the generated info.plist file that appeared (usually the last file in your project navigator)
- Go into your target > general and specify an info.plist. This should be the one in your new target folder.
- Click on your target in the top bar and from the dropdown select "manage scheme".
- Remove the copy scheme by highlighting and selecting "-" at the bottom of the panel
- Click on the "autocreate scheme" button
You should now have a separate target with unique files that will be used when this target is selected. Feel free to modify things like endpoints, authentication details, etc...