CFBundleGetBundleWithIdentifier(_:)
Locate a bundle given its program-defined identifier.
Declaration
func CFBundleGetBundleWithIdentifier(_ bundleID: CFString!) -> CFBundle!Parameters
- bundleID:
The identifier of the bundle to locate. Note that identifier names are case-sensitive.
Return Value
A CFBundle object, or NULL if the bundle was not found. Ownership follows the The Get Rule.
Discussion
For a bundle to be located using its identifier, the bundle must already have been loaded. The principal purpose for locating bundles by identifier is for code in frameworks or plugins to find its own bundle.
Bundle identifiers are created by entering a value for the key CFBundleIdentifier in the bundle’s Info.plist file.
To ensure uniqueness, you should create bundle identifiers with the form of reverse-DNS naming style package names, such as com.MyCompany.MyApp.bundleName.
Special Considerations
If a bundle object is created and the bundle file structure later deleted from the filesystem, this function will still return the original bundle object.