On my previous post, I modified the initial code in xcode template in order to make it support iOS 3.1.3. When i create a new project, i want to have that template on initial state. So i was thinking to create a project template in XCode. Unfortunately, i found it very difficult to create custom project template in XCode 4.2. So, i came up with the simple way to make it (later i’ll come back with the step to create a real custom project template in Xcode 4). Here is the currently steps that i did :
- Create new project, change the settings & the code as you like.
- Save the project.
- Done. The folder was created is our template application
When you want to use the template:
- Copy/Paste the project folder you have created. Rename the folder as you like
- Open the .xcodeproj in XCode
- Change the project name by simply double click (slowly) on your project name in the Navigator (the bar on the left)
- Hit Enter and then you should get a panel asking to confirm the renaming of your project’s target, prefix header file and any references to the app name in the main menu bar. Click Rename, and then OK
- Click the source folder in the Project Navigator. It should still have the old name project name. Click the arrow next to Full Path in the File Inspector to show the source folder in the Finder
- Rename the folder in the Finder to your new project name
- Go back to XCode and click the chooser button next to ‘Path’. Choose the folder you just renamed.
- Rename the GroupName in File Inspector
- Click on the top project node in the Project Navigator. In the Project Editor, click on your target. Under the Build Setttings tab, find the Prefix Header setting. Under the target column (not the the project column, if you are in levels view) double-click the path. It should be OldName/NewName-Prefix.pch where OldName is the old name of your project and NewName is the new name of your project. Update it to be NewName/NewName-Prefix.pch. Now search for the Info.plist File setting and update its path in a similar way
- Go into the Product menu and choose Manage Schemes. Highlight the existing scheme and click the remove button at the bottom of the table. Click Delete to confirm. Then click Autocreate Schemes Now. Click OK
- Clean and build your project to check if all is ok.
- Continue with your code
Hope this post be a helpful information.