I have the pid (process identifier) of an arbitrary running process. How can I find the bundle identifier (if any) of the associated application?
+1
A:
I've found an answer which works on 10.6 only:
[[NSRunningApplication runningApplicationWithProcessIdentifier:pid] bundleIdentifier]
invariant
2010-07-22 15:21:37
+2
A:
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.
JWWalker
2010-07-22 16:25:46
Perfect, thanks!
invariant
2010-08-02 10:08:29