Loads the bundle’s executable code and returns any errors.
- iOS 2.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
On input, a pointer to an error object variable. On output, this variable may contain an error object indicating why the bundle’s executable could not be loaded. If no error occurred, this parameter is left unmodified. You may specify
nilfor this parameter if you are not interested in the error information.
true if the bundle’s executable code was loaded successfully or was already loaded; otherwise,
false if the code could not be loaded.
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
NSFile- returned if the bundle’s executable file was not located.
No Such File Error
NSExecutable- 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.
Not Loadable Error
NSExecutable- returned if the bundle executable does not include code that matches the processor architecture of the current processor.
Architecture Mismatch Error
NSExecutable- returned if the bundle’s required Objective-C runtime information is not compatible with the runtime of the current process.
Runtime Mismatch Error
NSExecutable- 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.
NSExecutable- 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.