Bundles are the preferred packaging mechanism for most types of software in Mac OS X. The bundle structure lets you group executable code and the resources to support that code in one place and in an organized way. The following guidelines offer some additional advice on how to use bundles:
Store all resources required by an application to run inside the application bundle. This includes all images, strings files, localizable resources and plug-ins. See “Anatomy of a Modern Bundle” for more information.
If you plan to load C++ code from a bundle, you might want to mark the symbols you plan to load as extern "C"
. Neither NSBundle
or CFBundle
know about C++ name mangling conventions, so marking your symbols this way can make it much easier to identify them later.
You cannot use the NSBundle
class to load CFM-based code. If you need to load CFM-based code, you must use the functions of CFBundle
or CFPlugin
. You may load CFM-based plugins from a Mach-O executable using this technique.
You cannot use CFBundle
to load Objective-C or Java code. For Cocoa or Java code, you should always use NSBundle
.
Always include an information-property list in your bundle. Make sure you include the keys recommended for your bundle type, as discussed in Runtime Configuration Guidelines.
© 2003, 2005 Apple Computer, Inc. All Rights Reserved. (Last updated: 2005-11-09)