As soon as you know what product you are working on, you need an Xcode project. If the product is new, you can create an Xcode project from scratch. Xcode provides project templates to help you create a wide variety of products.
If you are working on an existing product, you probably already have a project. If you have an existing Xcode project, you can simply open the project in Xcode, as described in “Opening and Closing Projects.”
This chapter shows you how to create a project and describes the available project templates.
Fairly early in your design process, you make decisions related to the type of product (application, library, command-line tool, and so on) and language or languages (Objective-C, Objective-C++, or C) you plan to use. You also decide which Apple technologies and frameworks to use.
After you’ve resolved these issues, you’ll find that Xcode provides a wide variety of project templates to support your goals. The New Project dialog groups these templates under several product-type groups, such as applications, frameworks, Automator actions, and so on. Two additional templates create an empty project and a project that uses an external build system.
iOS: For information about the iOS project templates, see About iPhone OS Development and “Creating an iPhone Project” in iOS Development Guide.
Mac OS X: To learn about the Mac OS X products you can create, see Software Development Overview.
The project template you choose specifies a default target and also determines the default source files, resources, framework references, and other information that Xcode includes automatically in the project. A project generally contains all the information it needs to build a product for its default target. This includes a minimal set of source files that you can compile into a running product, as well as default build settings.
The project template names and descriptions should give you a good idea of which project template is right for your product. One way to learn more about a project template is to create a project with that template, examine its contents, and see what happens when you build it. Project templates may change, and new templates are added from time to time with releases of Xcode, but by trying out a template, you can easily examine its default contents in that version of Xcode.
Importing projects: Xcode doesn’t import Project Builder and ProjectBuilderWO projects. For these projects, you must create an Xcode project and add the older project’s files to it.
The name of your project may consist of uppercase and lowercase letters (a–z), numbers (0–9), dashes (-), and underscores (_). See Uniform Type Identifiers Overview for more information.
To open any project, choose File > Open, navigate to the project directory, and choose the .xcodeproj
file package you want to open. To open a project you’ve recently used, choose the project from the Recent Projects submenu in the File menu.
Xcode 3.2 can open projects that use the Xcode 2.4 and later project formats. If the opened project uses features that are not supported in Xcode 3.2, the project window displays an incompatibility notification in the project window status bar, as shown in Figure 2-1. To see details about the incompatibility, click the notification. See “Viewing Project Format Conflicts” for more information.
To close a project, close the project window.
You may work in a team in which some team members may need to use an Xcode release different from the one you use; for example, some developers may need to use Xcode 2.4 while you may want to use Xcode 3.2 to take advantage of features that are not available in earlier releases. If you use Xcode 3.2 to work on the same projects that an Xcode 2.4 user also works on, you have to make sure that you don’t use Xcode 3.2 features on those projects; otherwise, your Xcode 2.4–using colleague may have trouble working on or even opening the projects.
To help keep shared projects usable by developers using different Xcode releases, Xcode allows you to specify the release with which a project must remain compatible. This feature is based on project formats. A project format tells Xcode how to store the project configuration into the project file inside the project package (see “The Project Directory” for details). A project configuration is the set of development features, project attributes, and project and target build settings used in a project.
Project formats allow you to specify an Xcode release with which a project must be compatible. This feature lets you use a later release of Xcode to work on a project created with an earlier release while ensuring that the project remains compatible with the earlier release.
Note: Another approach to working on a development team that must use multiple Xcode releases is to install multiple Xcode releases on your computer. For example, you can have Xcode 2.4 and Xcode 3.2 on your computer, allowing you to work on Xcode 2.4–based projects and Xcode 3.2–based projects side by side. See Xcode Installation Guide for more information.
The rest of this section describes how to choose a project format for a project and how to view and resolve conflicts that arise between the project configuration and the chosen format.
You specify the project format for a project in the General pane of the Project Info window (Figure 1-3). The Project Format menu lists the project formats Xcode supports. When you choose a project format that doesn’t support the project configuration (for example, when a build setting isn’t supported by the chosen format), Xcode notifies you of the incompatibility as shown in Figure 2-2.
To view the details of the incompatibility, click the Show Conflicts button (this button is available only when there’s at least one conflict). See “Viewing Project Format Conflicts” for more information.
Important: When using cross-project references, ensure that the referenced projects use the same project format as the referencing project. If the project formats differ, you may encounter build errors.
When a project uses Xcode features that are not supported by the chosen project format, Xcode displays the unsupported features (or conflicts) in the Project Format Conflicts window, shown in Figure 2-3.
This window appears when you click the Show Conflicts button in the Project Info window or the project-conflict notification in the status bar (see “Choosing the Project Format” for details). You have two options for solving these conflicts:
Change the project format to one that supports the feature that’s causing the conflict.
Other developers working on the same project must use a release of Xcode that supports the same project format.
Change the project configuration so that it doesn’t use the feature that’s causing the conflict.
Last updated: 2010-07-02