Additional Configuration Tips

This chapter describes some miscellaneous techniques for configuring your application.

The PkgInfo File

The PkgInfo file is an alternate way to specify the type and creator codes of your application or bundle. This file is not required, but can improve performance for code that accesses this information. Regardless of whether you provide this file, you should always include type and creator information in your information property list file using the CFBundlePackageType and CFBundleSignature keys, respectively.

The contents of the PkgInfo file are the 4-byte package type followed by the 4-byte signature of your application. Thus, for the TextEdit application, whose type is 'APPL' and whose signature is 'ttxt', the file would contain the ASCII string “APPLttxt”.

Using Launch Arguments

If you have a Cocoa application, you can override many user defaults settings by specifying them on the command line. In addition, Cocoa recognizes a few additional arguments for opening and printing files. Table 1 lists some of the more commonly used command-line arguments for Cocoa applications.

Table 1  Command-line arguments for Cocoa applications

Argument

Description

-NSOpenfileName

Opens the specified file after the application finishes launching. Uses the application:openFile: method of the application’s delegate to open the file.

-NSOpenTempfileName

Opens the specified file as a temp file after the application finishes launching. Uses the application:openTempFile: method of the application’s delegate to open the file.

-NSPrintfileName

Prints the specified file after the application finishes launching. Uses the application:printFile: method of the application’s delegate to print the file.

-NSShowAllDrawing<YES>

Shows areas that are about to be drawn in yellow so that you can see which parts of your views are being updated. This is similar to the feature that is available through the Quartz Debug application but operates only on the specified application.

-NSTraceEvents<YES>

Displays a running log of events received by the application.