Loadable bundles written for the Cocoa runtime environment include a few features specific to Cocoa. Because they are written for Cocoa, they contain code for Objective-C classes. In particular, every Cocoa loadable bundle contains a principal class. The code loading mechanism provided by the NSBundle class uses a bundle’s principal class as an entry point. Applications loading bundles can ask NSBundle to find the principal class and use the returned Class
object to create an instance of that class.
NSBundle finds the principal class in one of two ways. First, it looks for the NSPrincipalClass
key in the bundle’s information property list. If the key is present, it uses the class named by the key’s value as the bundle’s principal class. If the key is not present or the key specifies a class that does not exist, NSBundle uses the first class loaded as the principal class. If the bundle is built with Xcode, the order of classes as viewed in the project determines the order in which they are loaded.
Last updated: 2007-08-10