The scenario is like this: "I run an app (say myproc) from one user and then fast user switch to second user"
Now, when I try to determine all processes running with a particular bundle Identifier (say com.ak.myproc); I am not able to determine this for processes running from first user.
I've tried the following but in vain:
[NSRunningApplication runningApplicationsWithBundleIdentifier:]
[[NSWorkspace sharedWorkspace] runningApplications]
and then comparing bundle identifier of each application - the app running for first user does not even show up in this list.- using
sysctl()
and then iterating through the process list - Here, the pid of the app from first user does come. After that:- When I try
[NSRunningApplication runningApplicationWithProcessIdentifier:]
, I get nil. - When I try
GetProcessForPID()
followed byProcessInformationCopyDictionary()
, I get a nil dictionary. - When I try
GetProcessForPID()
followed byGetProcessInformation()
, I do not get anything useful inProcessInfoRec
.
- When I try
Can somebody please help? Thanks.
OS: Mac OS X 10.8.4
Xcode: 4.6.2
You can map process name to bundle id using
NSWorkspace
.