I have the pid (process identifier) of an arbitrary running process. How can I find the bundle identifier (if any) of the associated application?
To locate the Apple bundle ID: Log into your iTunes Connect account. Click the relevant app. Go to General > App Information. The Bundle ID is displayed.
Open you project with XCode, select the top project item in the project navigator at the left. Then select TARGETS -> General. Bundle Identifier is found under Identity.
In Xcode 4, select your project, then your target (you should have only one) and then the 'Info' tab. You should be able to see the bundle identifier there.
I've found an answer which works on 10.6 only:
[[NSRunningApplication runningApplicationWithProcessIdentifier:pid] bundleIdentifier]
Here's a way that works in 10.2 and later: First call GetProcessForPID
to turn the pid into a ProcessSerialNumber
. Then call ProcessInformationCopyDictionary
to get the bundle ID. (Added: these functions are deprecated in OS 10.9. I don't know if they still exist in the 10.10 SDK.)
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