NSWorkspace is broken on Big Sur

Hello!

We rely on applications launch date information provided by NSWorkspace. Our main applications of interest are browsers (Safari, Chrome, Firefox).
We've noticed that NSWorkspace on Big Sur returns "nil" for all running applications including those that we are primarily interested in. This can be easily reproduced with the code sample below
Code Block
[[[NSWorkspace sharedWorkspace] runningApplications] enumerateObjectsUsingBlock:^(NSRunningApplication * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
NSLog(@"App %@ launched at %@", obj.bundleIdentifier, obj.launchDate);
}];

The issue is observed in all released beta builds of Big Sur including the latest beta 4.
Submitted the same report in feedback assistant: FB8098936

Will this be fixed? Or we should start thinking of alternative approaches for getting the launch date?
Thanks.

Best regards,
Arthur
Answered by Etresoft in 626397022
I can reproduce the problem easily enough. I can't tell you if it will be fixed or not. I would suggest getting alternative sources of this data. The only other official, legal way to get this information seems to be through proc_pidinfo. Here is an example:

Code Block
struct proc_bsdinfo bsdInfo;
int bsdSize =
proc_pidinfo(
pid, PROC_PIDTBSDINFO, 0, & bsdInfo, sizeof(bsdInfo));

I just tested it and it seems to work, even in the sandbox.
Accepted Answer
I can reproduce the problem easily enough. I can't tell you if it will be fixed or not. I would suggest getting alternative sources of this data. The only other official, legal way to get this information seems to be through proc_pidinfo. Here is an example:

Code Block
struct proc_bsdinfo bsdInfo;
int bsdSize =
proc_pidinfo(
pid, PROC_PIDTBSDINFO, 0, & bsdInfo, sizeof(bsdInfo));

I just tested it and it seems to work, even in the sandbox.
Thanks a lot! Yeah, I've also quickly checked just now. Seems to be working fine and should cover our use case.
I still hope that Apple would at least respond or just silently fix it (as they did with other bugs I've reported) because I think NSWorkspace should work :)
But at least now there is a workaround in case it's not fixed in time. That's already good news.
As suspected this was fixed in Big Sur beta 5 with no response from Apple :)
Well, good that's fixed at least.
NSWorkspace is broken on Big Sur
 
 
Q