问题
NSArray *activeApps = [[NSWorkspace sharedWorkspace] runningApplications];
Returns running applications and agents, but i cannot see my running XPC mach service (although it is running and visible in activity monitor processes)
even when i look up the PID in activity monitor
id res = [NSRunningApplication runningApplicationWithProcessIdentifier:223];
i get res nil, although with other processes this works well
回答1:
The NSRunningApplication documentation states:
Only user applications are tracked; this does not provide information about every process on the system
What exactly you trying to accomplish? you dont need to check for a service in this way.
来源:https://stackoverflow.com/questions/26361106/nsworkspace-runningapplications-doesnt-return-my-xpc-mach-service