If you want only applications, the | NSWorkspace class offers
- (NSArray *)launchedApplications;
Use it as follows:
NSArray *runningApps = [[NSWorkspace sharedWorkspace] launchedApplications];
The array contains NSDictionary objects of which structure is defined in the Cocoa documentation.
However, what you will get here is an array of applications: not processes.
If you want information about processes you have either to turn back to standard Unix calls,
either to create a NSTask to execute the classic shell command ps with the adequate parameters and pipe its output to your own code, parse the results, etc.
or either take a look at this Apple TechNote for a solution involving Carbon calls.
|