In my Cocoa app I am detecting visible windows and getting PID of their owners. Then for ever PID I create NSRunningApplication object (using runningApplicationWithProcessIdentifier:) to get additional info (localized name, path, attributes etc.)
Everything works fine until I try to create NSRunningApplication with PID 88 which belongs (in my case) to Window Server. It just do not create that object and in accordance with Apple manual it returns nil - in other words: There is no process with that PID.
How is it possible? If it wouldn't exist I would't be able to get its PID and ps would't show it.
Any advice?
From the documentation (emphasis added):