Contents

loadAndReturnError()

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

Declaration

func loadAndReturnError() throws

Discussion

If this method returns false and you pass a value for the error parameter, a suitable error object is returned in that parameter. Potential errors returned are in the Cocoa error domain and include the types that follow. For a full list of error types, see FoundationErrors.h.

  • NSFileNoSuchFileError - returned if the bundle’s executable file was not located.

  • NSExecutableNotLoadableError - returned if the bundle’s executable file exists but could not be loaded. This error is returned if the executable is not recognized as a loadable executable. It can also be returned if the executable is a PEF/CFM executable but the current process does not support that type of executable.

  • NSExecutableArchitectureMismatchError - returned if the bundle executable does not include code that matches the processor architecture of the current processor.

  • NSExecutableRuntimeMismatchError - returned if the bundle’s required Objective-C runtime information is not compatible with the runtime of the current process.

  • NSExecutableLoadError - returned if the bundle’s executable failed to load for some detectable reason prior to linking. This error might occur if the bundle depends on a framework or library that is missing or if the required framework or library is not compatible with the current architecture or runtime version.

  • NSExecutableLinkError - returned if the executable failed to load due to link errors but is otherwise alright.

The error object may contain additional debugging information in its description that you can use to identify the cause of the error. (This debugging information should not be displayed to the user.) You can obtain the debugging information by invoking the error object’s description method in your code or by using the print-object command on the error object in gdb.

See Also

Loading Code from a Bundle