Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSBundleMBS class.
NSBundleMBS.builtInPlugInsFolder as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns the appropriate path for modern application and framework bundles. This method may not return a path for non-standard bundle formats or for some older bundle formats.
NSBundleMBS.builtInPlugInsPath as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns the appropriate path for modern application and framework bundles. This method may not return a path for non-standard bundle formats or for some older bundle formats.
NSBundleMBS.bundleFolder as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Some examples using this method:
NSBundleMBS.bundleIdentifier as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns the receiver's bundle identifier, which is defined by the CFBundleIdentifier key in the bundle's information property list.
NSBundleMBS.bundlePath as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Some examples using this method:
NSBundleMBS.Constructor(path as folderitem)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Creates the NSBundle object that corresponds to fullPath, or fails if fullPath does not identify an accessible bundle directory. On failure the handle property is 0.
This method allocates and initializes the returned object if there is no existing NSBundle associated with fullPath, in which case it returns the existing object.
See also:
NSBundleMBS.Constructor(path as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Creates the NSBundle object that corresponds to fullPath, or fails if fullPath does not identify an accessible bundle directory. On failure the handle property is 0.
This method allocates and initializes the returned object if there is no existing NSBundle associated with fullPath, in which case it returns the existing object.
See also:
NSBundleMBS.developmentLocalization as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The returned localization corresponds to the value in the CFBundleDevelopmentRegion key of the bundle's property list (Info.plist).
NSBundleMBS.executableArchitectures as Integer()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method scans the bundle's Mach-O executable and returns all of the architecture types it finds. Because they are taken directly from the executable, the returned values may not always correspond to one of the well-known CPU types defined in "Mach-O Architecture."
NSBundleMBS.executableFile as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSBundleMBS.executablePath as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSBundleMBS.infoDictionary as dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns a dictionary, constructed from the bundle's Info.plist file, that contains information about the receiver. If the bundle does not contain an Info.plist file, a valid dictionary is returned but this dictionary contains only private keys that are used internally by the NSBundle class. The NSBundle class may add extra keys to this dictionary for its own use.
NSBundleMBS.isLoaded as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true if the bundle's code is currently loaded, otherwise false.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true if the method successfully loads the bundle's code or if the code has already been loaded, otherwise false.
You can use this method to load the code associated with a dynamically loaded bundle, such as a plug-in or framework. Prior to Mac 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 Mac OS X version 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.
NSBundleMBS.localizations as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returna an array, containing strings, that specifies all the localizations contained within the receiver's bundle.
NSBundleMBS.localizedInfoDictionary as dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns a dictionary with the keys from the bundle's localized property list (InfoPlist.strings).
This method uses the preferred localization for the current user when determining which resources to return. If the preferred localization is not available, this method chooses the most appropriate localization found in the bundle.
NSBundleMBS.localizedStringForKey(key as string, value as string="", tableName as string="") as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
key: The key for a string in the table identified by tableName.
value: The value to return if key is "" or if a localized string for key can't be found in the table.
tableName: The receiver's string table to search. If tableName is an empty string, the method attempts to use the table in Localizable.strings.
Returns a localized version of the string designated by key in table tableName. If value is nil or an empty string, and a localized string is not found in the table, returns key. If key and value are both nil, returns the empty string.
For more details about string localization and the specification of a .strings file, see "Working With Localized Strings."
Using the user default NSShowNonLocalizedStrings, you can alter the behavior of localizedStringForKey to log a message when the method can't find a localized string. If you set this default to true (in the global domain or in the application's domain), then when the method can't find a localized string in the table, it logs a message to the console and capitalizes key before returning it.
The following example cycles through a static array of keys when a button is clicked, gets the value for each key from a strings table named Buttons.strings, and sets the button title with the returned value:
NSBundleMBS.pathForImageResource(name as string) as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
name: The name of the image resource file, without any pathname information. Including a filename extension is optional.
Returns the absolute pathname of the resource file or nil if the file was not found.
Image resources are those files in the bundle that are recognized by the NSImage class, including those that can be converted using the Image IO framework.
NSBundleMBS.pathForResource(name as string, extension as string) as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
name: The name of the resource file.
extension: If extension is an empty string, the extension is assumed not to exist and the file URL is the first file encountered that exactly matches name.
Returns the full pathname for the resource file or nil if the file could not be located.
The method first looks for a matching resource file in the non-localized resource directory of the specified bundle. (In Mac OS X, this directory is typically called Resources but in iPhone OS, it is the main bundle directory.) If a matching resource file is not found, it then looks in the top level of any available language-specific ".lproj" directories. (The search order for the language-specific directories corresponds to the user's preferences.) It does not recurse through other subdirectories at any of these locations. For more details see Bundles and Localization.
The following code fragment gets the path to a plist within the bundle, and loads it into a dictionary.
See also:
NSBundleMBS.pathForResource(name as string, extension as string, subpath as string) as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
name: The name of the resource file.
extension: If extension is an empty string, the extension is assumed not to exist and the file URL is the first file encountered that exactly matches name.
subpath: The name of the bundle subdirectory.
Returns the full pathname for the resource file or nil if the file could not be located.
If subpath is "", this method searches the top-level nonlocalized resource directory and the top-level of any language-specific directories. (In Mac OS X, the top-level nonlocalized resource directory is typically called Resources but in iPhone OS, it is the main bundle directory.) For example, suppose you have a Mac OS X application with a modern bundle and you specify "Documentation" for the subpath parameter. This method would first look in the Contents/Resources/Documentation directory of the bundle, followed by the Documentation subdirectories of each language-specific .lproj directory. (The search order for the language-specific directories corresponds to the user's preferences.) This method does not recurse through any other subdirectories at any of these locations. For more details see Bundles and Localization.
See also:
NSBundleMBS.pathForResource(name as string, extension as string, subpath as string, localizationName as string) as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
name: The name of the resource file.
extension: If extension is an empty string, the extension is assumed not to exist and the file URL is the first file encountered that exactly matches name.
subpath: The name of the bundle subdirectory to search.
localizationName: The name of the localization. This parameter should correspond to the name of one of the bundle's language-specific resource directories without the .lproj extension.
Returns the full pathname for the resource file or nil if the file could not be located.
This method is equivalent to pathForResource:ofType, except that only nonlocalized resources and those in the language-specific .lproj directory specified by localizationName are searched.
There should typically be little reason to use this method—see Getting the Current Language and Locale.
See also:
NSBundleMBS.pathForSoundResource(name as string) as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
name: The name of the sound resource file, without any pathname information. Including a filename extension is optional
Returns the folderitme of the resource file or nil if the file was not found.
Sound resources are those files in the bundle that are recognized by the NSSound class. The types of sound files can be determined by calling the soundUnfilteredFileTypes method of NSSound.
NSBundleMBS.preferredLocalizations as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
An array of strings, each of which identifies the a localization in the receiver's bundle. The localizations in the array are not returned in any particular order.
NSBundleMBS.privateFrameworksFolder as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns the appropriate path for modern application and framework bundles. This method may not return a path for non-standard bundle formats or for some older bundle formats.
NSBundleMBS.privateFrameworksPath as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns the appropriate path for modern application and framework bundles. This method may not return a path for non-standard bundle formats or for some older bundle formats.
NSBundleMBS.resourceFolder as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSBundleMBS.resourcePath as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSBundleMBS.sharedFrameworksFolder as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns the appropriate path for modern application and framework bundles. This method may not return a path for non-standard bundle formats or for some older bundle formats.
NSBundleMBS.sharedFrameworksPath as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns the appropriate path for modern application and framework bundles. This method may not return a path for non-standard bundle formats or for some older bundle formats.
NSBundleMBS.sharedSupportFolder as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns the appropriate path for modern application and framework bundles. This method may not return a path for non-standard bundle formats or for some older bundle formats.
NSBundleMBS.sharedSupportPath as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns the appropriate path for modern application and framework bundles. This method may not return a path for non-standard bundle formats or for some older bundle formats.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true if the bundle was successfully unloaded or was not already loaded; otherwise, false if the bundle could not be unloaded.
This method attempts to unload a bundle's executable code using the underlying dynamic loader (typically dyld). You may use this method to unload plug-in and framework bundles when you no longer need the code they contain. You should use this method to unload bundles that were loaded using the methods of the NSBundle class only. Do not use this method to unload bundles that were originally loaded using the bundle-manipulation functions in Core Foundation.
It is the responsibility of the caller to ensure that no in-memory objects or data structures refer to the code being unloaded. For example, if you have an object whose class is defined in a bundle, you must release that object prior to unloading the bundle. Similarly, your code should not attempt to access any symbols defined in an unloaded bundle.
Prior to Mac OS X version 10.5, code could not be unloaded once loaded, and this method would always return false. In Mac OS X version 10.5 and later, you can unload a bundle's executable code using this method.
Available in Mac OS X v10.5 and later.
The items on this page are in the following plugins: MBS MacBase Plugin.