Instance Method

load

Dynamically loads the bundle’s executable code into a running program, if the code has not already been loaded.

Declaration

- (BOOL)load;

Return Value

YES if the method successfully loads the bundle’s code or if the code has already been loaded, otherwise NO.

Discussion

You can use this method to load the code associated with a dynamically loaded bundle, such as a plug-in or framework. Prior to OS X version 10.5, a bundle would attempt to load its code—if it had any—only once. Once loaded, you could not unload that code. In macOS 10.5 and later, you can unload a bundle’s executable code using the unload method.

You don’t need to load a bundle’s executable code to search the bundle’s resources.

This method initializes the principal class in the bundle. To add code you want executed after loading, override the initialize class method of the principal class.

Special Considerations

If an NSBundle object calls the load method, it calls the unload method before being deallocated. Therefore, you should retain any NSBundle object for as long as any code from it is used by the app.

See Also

Loading Code from a Bundle

executableArchitectures

An array of numbers indicating the architecture types supported by the bundle’s executable.

preflightAndReturnError:

Returns a Boolean value indicating whether the bundle’s executable code could be loaded successfully.

loadAndReturnError:

Loads the bundle’s executable code and returns any errors.

unload

Unloads the code associated with the receiver.

loaded

The load status of a bundle.

Mach-O Architecture

Constants describing the CPU types that a bundle’s executable code supports.