Xcode 4 specification files




















You can edit a build setting at any level. The level at which the build setting is actually set is highlighted in green. The value to which the build setting is set is listed in the Resolved column. Most developers never need to change the default of the vast majority of the build settings.

However, there are a few basic settings that you must check, and possibly edit, for each target. These settings are gathered into one pane in the Project editor—labeled the Summary pane—and are somewhat different for OS X and iOS projects. Figure shows the build settings summary pane for an OS X project. Each setting in the Summary pane is also found in one of the other panes.

When you edit a setting, Xcode updates the other pane automatically. An application sandbox enforces restrictions, known as entitlements , on how an application can interact with the rest of the system. A sandboxed application is harder to compromise and therefore enhances security for users. In Xcode 4. You can set entitlements for each target in the project editor Figure There is also a default code-signing entitlements file available in the file templates in the utilities pane.

When you enable application sandboxing, you can select an entitlements file if you already have one. If you do not, Xcode creates one with the name of your project and the extension entitlements. You can view and edit this file with the property list editor in Xcode Figure Xcode 4 includes editors for source code, property list. To open or display any of these editors, select a file of that type in the project navigator.

The editor opens automatically in the editor area of the workspace window. Any file for which Xcode does not have an editor is displayed using the same Quick Look facility used by the Finder.

Each document-type editor has custom commands in the Navigate and Editor menus to act on the information in that document type. For example, code folding, code completion, Quick Help, automatic indentation, syntax coloring, edit all in scope, and automatic balancing of delimiters are all available and similar to the same features in Xcode 3. Look through the Edit menu, the shortcut menu, and Xcode preferences to find these features.

Many of the keyboard shortcuts are unchanged. Use the Key Bindings pane in Xcode preferences to see and edit the keyboard shortcuts. The user interface for code completion is similar to that in Xcode 3, but there are some important differences. Click an item in the suggestion list or use the up and down arrows to select one.

As you do so, the inline suggestion changes as well. Furthermore, as you can see in the figure, if you open the Quick Help inspector, you can read documentation about each selection.

You can disable automatic code completion in the Text Editing pane of Xcode preferences, but you can always invoke code completion by pressing Control-Spacebar. A Quick Help pop-up dialog is also available from code completion, even when the Quick Help inspector is not open. As before, press the Tab key to accept the prefix or Return to accept the entire suggestion. Click the Done button in the Quick Help pop-up dialog to cancel the operation. If all of the possible completions have a common prefix NSString in Figure , the prefix is indicated with a dotted underline.

Press the Tab key to accept only the prefix. Press Return to accept the entire autocompletion suggestion. If there is no common prefix, code completion shows the dotted underline up to the next uppercase letter in the symbol Figure Again, press Tab to accept only the subword, or press Return to accept the entire suggestion. Press Control—Space bar to toggle the completion suggestion on or off.

That is, if the inline suggestion and list are being displayed, pressing Control—Space bar cancels the code completion operation.

If there is no suggestion displayed, place the cursor at the end of a partially typed symbol and press Control—Space bar to get completion suggestions. Note that in Xcode 4, pressing the Esc Escape key cancels the operation and pressing the Delete key always deletes the preceding character. When your target is set to use the LLVM compiler, a new feature called Fix-it scans your source text as you type.

Fix-it marks syntax errors with a red underscore or a caret at the position of the error, and a symbol in the gutter. Clicking the symbol displays a message describing the possible syntax error and in many cases offers to repair it automatically Figure By default, when you Option-click a file in one of the navigators or jump bars, an assistant editor opens in manual mode and displays the file in the assistant editor pane see Split the Editor Area.

To change this behavior and to set other keyboard shortcuts for opening files, open the General pane of Xcode preferences. You can edit the hexadecimal code directly, or you can edit in the plain text column. Editing either updates the other.

The preprocessor evaluates directives in your source code for example, instructions starting with the number sign , such as includes, defines, and conditional logic and converts them into C code to be sent to the compiler. You can examine the preprocessed output to make sure that the logic in your source code is being interpreted by the preprocessor as you expect in order to debug compilation problems. The assembly output is the set of instructions that the compiler generated from the preprocessed output.

You can study the assembly output to see how the instructions were formed or ordered, to seek out better optimization patterns, or to look for compiler bugs. You can also see the raw key value in Quick Help in the Quick Help. In Xcode 3 you have to set an active target, a build configuration, and an executable as separate items.

The problem with this approach is that targets, configurations, and executables are intimately linked. At its simplest, for example, a target contains one product, which is executed without any special options or environmental settings.

However, sometimes the product requires values for input parameters or other customization before it can be executed. In Xcode 4, you select a scheme , which specifies which targets to build, what build configuration to use, which debugger to use, and which executable to launch when you choose Run from the Product menu or click the Run button at the left end of the toolbar.

Each scheme also specifies a set of options for several possible actions:. When you open an existing Xcode project or create a new one , Xcode 4 automatically creates a scheme for you. To select a scheme, you use the Scheme pop-up menu in the upper-left corner of the Xcode window Figure To create a new scheme, choose New Scheme from that menu. To edit existing schemes, choose the scheme you want to edit and then choose Edit Active Scheme from that menu.

By default, Xcode creates one scheme per target in your project or workspace. For each target, you use the build pane of the scheme editor Figure to specify which targets are built for each type of action. You can add as many targets from your project or workspace to a single scheme as you wish. The figure shows four targets: the SurfWriter application, a custom framework needed to build the application, an Automator plug-in to be provided with the application, and a command-line tool that can be used with the application.

In the figure, the SurfWriter application and framework are set to be built for every action, but the plug-in is set to be built only when the application is built for running that is, for debugging and for archiving that is, for distribution.

Each of these actions has associated options that you can customize with the scheme editor. Note that you can choose to display the running product at a higher UI resolution to simulate running at a different display resolution. You can also specify whether each scheme should be displayed in the pop-up menu, where the scheme is stored in the project or workspace and whether the scheme should be shared with others using the project or workspace.

Rather than a Find group and batch find panel, Xcode 4 has a find navigator. Click the magnifying glass icon in the navigation pane, type a term in the search field, and press Return to search through the entire project or all the projects in the Xcode workspace workspaces are discussed in Work with Multiple Related Projects.

The results are displayed in the find navigator Figure Just as in Xcode 3, click a find result to see the instance of the term in the source editor.

To customize the search, click the magnifying glass in the search field and choose Show Find Options to get the Find Options dialog Figure Click the second button from the left in the navigator selector bar to browse through the symbols in your project Figure Note that you need to wait until Xcode finishes indexing your project before you can use this feature. Use the search field and scope buttons at the bottom of the navigator to specify exactly what is listed.

The scope buttons are blue when toggled on and black when off. Use the buttons in any combination:. A nib file may have the file name extension nib or xib. When you open a nib file, the Interface Builder inspectors appear in the utility area. You can select Interface Builder objects in the library pane and drag them onto the Interface Builder canvas. Figure shows Interface Builder and associated panes open in the workspace window.

When you create a new Cocoa application or iOS view-based project, Xcode includes a nib file for your main view and a view controller class. When you need a new nib file for a project, you should create the interface and implementation files for the controller first. In many cases, Xcode creates a nib file as well. As nib files usually have controllers already assigned to them, it is rarely necessary to add a separate view controller to a nib file.

Whether you choose New File or drag the nib file from the File Template library, be sure you select the appropriate file type for the correct platform. For example, there are two nib templates named Application: one for iPhone and iPad, and one for Cocoa. In Xcode 3, you typically add a new class to the class hierarchy in Interface Builder, add outlets and action methods, and then ask Interface Builder to create the corresponding header and implementation files for you in Xcode. Keeping your class files synchronized between Interface Builder and Xcode can be a problem with Xcode 3.

In Xcode 4, on the other hand, all class creation is done directly by Xcode. Xcode creates both a header file and an implementation file and adds them to your project.

Open the new nib file by selecting it in the project navigator so that it appears in the Interface Builder editor. After adding the source file templates to your project, drag a custom view object from the library into the nib file, as shown in Figure After adding the custom view to your nib, select the custom view and assign the correct class to it in the class field under Custom Class in the Identity inspector Figure To create a new controller for a nib file, first use the New File dialog to create interface and implementation files for the new class.

If you want to make connections in Interface Builder to the outlets and actions of the controller, drag the Object object from the Object library in the Utilities pane into the dock of your Interface Builder nib file Figure Tip: Type nsobject into the search field to find the object quickly. Select the new object in the dock and use the class field under Custom Class in the Identity inspector Figure to assign the class of your controller to the object.

For example, if you double-click a texture object, you can see the texture in detail. As of Xcode 4. To set a location, choose Edit Scheme from the scheme selector in the toolbar, select the Run action, and click the Options tab. You can then choose a location from the Location menu. In addition, if you are running an application for iOS 5.

To improve download time and installation efficiency with Xcode 4. Xcode presents you with a dialog when the simulator needs to be downloaded.

Documentation preferences has consequently been replaced with Downloads preferences, including both documentation and components simulators and SDKs.

Using the Components tab of the Downloads preferences pane, you can view a description of each available component, download and install it. This version of Xcode is distributed as a single application bundle, Xcode.

Installing Xcode 4. These changes make it easier for you to install and update Xcode using the standard Mac App Store mechanism. The Xcode 4. For your convenience, you can also add these tools to the Dock to allow direct access. The command-line tools are not bundled with Xcode 4. Instead, they can be installed optionally using the Components tab of the Downloads preferences panel.

The simplification afforded by repackaging Xcode 4. As a result, the Install Xcode application and the uninstall-devtools command line script are also no longer needed. Sample Code. Plug-ins, templates and other sub-components. For example, Instruments templates—files such as Automation. Other standalone utility applications and add-on technologies. Several additional tools are no longer part of the default Xcode installation, they are now downloadable as separate packages. The More Developer Tools menu command provides a direct jump to developer.

New Cocoa projects created in Xcode 4. It can be disabled by deselecting an option in the Interface Builder design canvas:. Otherwise, Xcode 4. Additional improvements to Xcode robustness and reliability have been incorporated. See Xcode Release Notes — Archive for more detailed update information.

Xcode supports backward deployment of code that uses the literal syntax and object subscripting to OS X v The default synthesize feature requires no special SDK or runtime support.

The static analyzer engine can find complicated bugs that span function boundaries using interprocedural analysis. More exhaustive memory checks are made to malloc -related memory management and the detection of insecure API uses.

The Scene Kit editor allows you to preview and fine-tune the 3D scenes, and play embedded animations. You can also inspect 3D scenes for information to use in your source code. Code completion now has an integrated form of QuickHelp with a short description of each item in the list based on the documentation or the specific code snippet. Integrated within the code completion window, it is displayed in a section either above or below the code completion list.

Xcode can offer symbols during code completion that haven't yet been included or imported in the current file the framework was added to the project, but the import was not included in the file. When possible, Xcode will use umbrella headers for auto import completions and will denote not-yet-linked symbols with a error indicating which binary needs to be linked.

It is a known limitation that auto import completions are available only for symbols that are already visible in at least one file in the current workspace. If necessary, this can be turned off in the Text Editing preferences. The Find Bar and Search Navigator have added support for find patterns as a simpler alternative to regular expressions. In the search field, click the magnifying glass icon and select Insert Pattern.

The Find Navigator now supports searching for references to indexed symbols. Choose Symbolic from the Find Navigator's Style pop-up menu. This form of search performs significantly faster than textual searches and excludes results from comments and nonsource files. Xcode can show the callers and callees of the current function or method. This function is accessed from the Show Related Items menu, or by using the Assistant editor and selecting Callers or Callees in the jump bar pop-up menu.

The source editor jump bar pop-up menu now lists TODO and pragma mark comments that are inside methods and functions. Pinch-to-zoom and two-finger-double-tap change the zoom level in the following editors and viewers:. Improved localization workflow using base language. For full details of Objective-C language feature availability, tools, and deployment capability, see Objective-C Feature Availability Index. This new capability extends the cross-function analysis for C functions that was introduced in Xcode 4.

This enhancement greatly reduces the need to cast arguments and the results of message sends, and makes properties more often usable particularly from system classes. LLDB has improved support for stepping over inlined functions. Major highlights of this release include:. See Xcode Release Notes — Archive for more information.

All Rights Reserved.



0コメント

  • 1000 / 1000