AppleBundle - UBogun/Xojo-iosLib GitHub Wiki
Inherits from AppleObject
Memory leak check: not yet done
Status: complete, the notification not implemented because you will use it usually on a different place. The notification constant is included.
This is an implementation of NSBundle, the iOS native class for localizing code and ressources available to your app.
AppleBundle is not interchangeable with AppleCFBundle
General information
It is not necessary to get the bundle four your app via one of the constructor methods. The MainBundle shared property represents it already.
The constructors expect rather complicated pathnames, especially for debugbuilds. Examine the MainBundle properties to get an idea of how they are formed.
Localization identifiers that are used by some methods require the form of "en" or "en_GB" etc.
Constructors
Constructor (Path as CFStringRef): Returns the bundle for the path to a directory. This must be a full pathname for a directory; if it contains any symbolic links, they must be resolvable.
Constructor (URL as AppleURL): Returns an NSBundle object initialized to correspond to the specified file URL. This must be a full URL for a directory; if it contains any symbolic links, they must be resolvable.
Properties
AppStoreReceiptURL As AppleURL (read-only): The file URL for the bundle’s App Store receipt.
BuiltInPlugInsPath As Text (read-only): The full pathname of the bundle’s subdirectory containing plug-ins.
BuiltInPlugInsURL As AppleURL (read-only): The file URL of the bundle’s subdirectory containing plug-ins.
BundleIdentifier As Text (read-only): The bundle’s identifier.
BundlePath As Text (read-only): The full pathname of the bundle's directory.
BundleURL As AppleURL (read-only): The full URL of the bundle’s directory.
DevelopmentLocalization As Text (read-only): The localization for the development language.
ExecutableArchitectures As AppleArray (read-only): An array of AppleNumbers indicating the architecture types supported by the bundle’s executable. See the NSBundleExectuableArchitecture… constants defined in this class for possible values.
ExecutablePath As Text (read-only): The full pathname of the bundle's executable file.
ExecutableURL As AppleURL (read-only): The file URL of the bundle’s executable file.
InfoDictionary As AppleDictionary (read-only): A dictionary, constructed from the bundle's Info.plist file, that contains information about the bundle.
Loaded As Boolean (read-only): The load status of a bundle.
Localizations As AppleArray (read-only): A list of all the localizations contained in the bundle.
LocalizedInfoDictionary As AppleDictionary (read-only): A dictionary with the keys from the bundle’s localized property list.
PreferredLocalizations As AppleArray (read-only): An ordered list of preferred localizations contained in the bundle.
PrincipalClass As Ptr (read-only): The bundle’s principal classptr.
PrincipalClassName As Ptr (read-only): The bundle’s principal classname.
PrivateFrameworksPath As Text (read-only): The full pathname of the bundle’s subdirectory containing private frameworks.
PrivateFrameworksURL As AppleURL (read-only): The file URL of the bundle’s subdirectory containing private frameworks.
ResourcePath As Text (read-only): The full pathname of the bundle’s subdirectory containing resources.
ResourceURL As AppleURL (read-only): The file URL of the bundle’s subdirectory containing resource files.
SharedFrameworksPath As Text (read-only): The full pathname of the bundle’s subdirectory containing shared frameworks.
SharedFrameworksURL As AppleURL (read-only): The file URL of the bundle’s subdirectory containing shared frameworks.
SharedSupportPath As Text (read-only): The full pathname of the bundle’s subdirectory containing shared support files.
SharedSupportURL As AppleURL (read-only): The file URL of the bundle’s subdirectory containing shared support files.
Methods
ClassNamed (ClassName As CFSTringRef) As Ptr: Returns the ClassPtr for the specified name.
ClassNameNamed (ClassName As CFSTringRef) As Text: Returns the Classname for the specified name.
InfoDictionaryObject (Key As CFStringRef) As AppleObject: Returns the value associated with the specified key in the bundle’s information property list.
InstancePaths (Directory As CFStringRef) As AppleArray: Returns an array containing the pathnames for all bundle resources having the specified filename extension and residing in the resource subdirectory.
LocalizedPath (Name As CFStringRef, Type As CFStringRef, Directory As CFStringRef, Localization As CFStringRef) As Text: Returns the full pathname for the resource identified by the specified name and file extension, located in the specified bundle subdirectory, and limited to global resources and those associated with the specified localization.
LocalizedPaths (Extension As CFStringRef, Directory As CFStringRef, Localization As CFStringRef) As AppleArray: Returns an array containing the file for all bundle resources having the specified filename extension, residing in the specified resource subdirectory, and limited to global resources and those associated with the specified localization.
LocalizedString (Key As CFStringRef, Value As CFStringRef, Table As CFStringRef) As Text: Returns a localized version of the string designated by the specified key and residing in the specified table.
LocalizedURLs (Extension As CFStringRef, SubDirectory As CFStringRef, Localization As CFStringRef) As AppleArray: Returns an array containing the file URLs for all bundle resources having the specified filename extension, residing in the specified resource subdirectory, and limited to global resources and those associated with the specified localization.
Path (Name As CFStringRef, Type As CFStringRef, opt. Directory As CFStringRef As Text: Returns the full pathname for the resource identified by the specified name and file extension and, if defined, located in the specified bundle subdirectory.
PathForAuxiliaryExecutable (Name As CFStringRef) As Text: Returns the full pathname of the executable with the specified name in the bundle.
Preflight (ByRef Error As AppleError) As Boolean: Returns a Boolean value indicating whether the bundle’s executable code could be loaded successfully. Changes Error accordingly.
PreservationPriority (Tag As CFStringRef) As Double: Returns the current preservation priority for the specified tag. Available since iOS 9.0.
SetPreservationPriority (Priority As Double, Tags As Appleset): Sets a hint to the system of the relative order for purging tagged sets of resources in the bundle. Available since iOS 9.0.
Unload() As Boolean: Unloads the code associated with the receiver. Returns the unload success.
URL (Name As CFStringRef, Extension As CFStringRef, opt. SubDirectory As CFStringRef) As AppleURL: Returns the file URL for the resource file identified by the specified name and extension and, if defined, residing in a given bundle directory.
URLForAuxiliaryExecutable (Name As CFStringRef) As AppleURL: Returns the file URL of the executable with the specified name in the bundle.
URLs (Extension As CFStringRef, SubDirectory As CFStringRef) As AppleArray: Returns an array of file URLs for all resources identified by the specified file extension and located in the specified bundle subdirectory.
Shared Properties
AllBundles* As AppleArray (read-only): An array of all the application’s non-framework bundles.
AllFrameworks* As AppleArray (read-only): An array of all of the application’s bundles that represent frameworks.
MainBundle As AppleBundle (read-only): The NSBundle object that corresponds to the directory where the current application executable is located.
Shared Methods
BundleForClass (aClass As Ptr) As AppleBundle: Returns the NSBundle object with which the specified class is associated.
BundleWithIdentifier (Identifier As CFStringRef) As AppleBundle: Returns a previously created NSBundle instance that has the specified bundle identifier.
ClassPath (Name As CFStringRef, Type As CFStringRef, Directory As CFStringRef As Text: Returns the full pathname for the resource file identified by the specified name and extension and residing in a given bundle directory.
Paths (Extension As CFStringRef, Directory As CFStringRef) As AppleArray: Returns an array containing the pathnames for all bundle resources having the specified extension and residing in the bundle directory at the specified path.
PreferredLocalizations (LocalizationsArray As AppleArray, opt. PreferencesArray As AppleArray) As AppleArray: Returns the localizations that a bundle object would prefer, given the specified bundle and user’s language preferences.
URLinBundle (Name As CFStringRef, Extension As CFStringRef, Directory As CFStringRef, URL As AppleURL) As AppleURL: Creates and returns a file URL for the resource with the specified name and extension in the specified bundle.
URLsInBundle (Extension As CFStringRef, Directory As CFStringRef, URL As AppleURL) As AppleArray: Returns an array containing the file URLs for all bundle resources having the specified filename extension, residing in the specified resource subdirectory, within the specified bundle.
Constants
NSBundleDidLoadNotification As Text: Use this constant for registering at an AppleNotificationCenter to receive BundleLoad notifications.
NSBundleExecutableArchitecturexxx: 4 Integer values for deciphering the meaning of ExeutableArchitectures values.