I want to create a bundle from an arbitrary bundle identifier
e.g. com.apple.iokit.IOStorageFamily
It's not an unreasonable thing to do as bundle IDs are supposed
to be unique, however the obvious code does not work:
NSString* bID = @"com.apple.iokit.IOStorageFamily";
NSBundle* bundle = [NSBundle bundleWithIdentifier:bID];
This code only works for bundles you've already loaded
(hello, chicken and egg problem), and in fact, you have
to know a little more than you'd like about the the identifier
before you can do anything. For the above style of ID
I grep out the final component and tranform it into/System/Library/Extensions/IOStorageFamily.kext
which I then load by path.
Is this the state of the art or is there a more general way?
A bundle ID or bundle identifier uniquely identifies an application in Apple's ecosystem. This means that no two applications can have the same bundle identifier. To avoid conflicts, Apple encourages developers to use reverse domain name notation for choosing an application's bundle identifier.
The simplest method to look up an app's package ID is to find the app in Google Play Store using a web browser. The app package ID will be listed after 'id=' at the end of the URL. There are several Android apps available in Play Store that lets you find Package name IDs for apps published in Play Store.
You can not directly look up and find the bundle ID of an App in the Apple App Store unlike Google playstore for Android where it provides applications package name (Android equivalent of Bundle ID) in the app's playstore link.
Use this
NSString *path = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.apple.TextEdit"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With