Hello,
Our application uses following code to activate itself:
void BecomeFrontMostApp() {
@autoreleasepool {
if ([NSApp isActive] == YES) return;
[[NSRunningApplication currentApplication] activateWithOptions: NSApplicationActivateIgnoringOtherApps | NSApplicationActivateAllWindows ];
}
}
Code works on Ventura and previous OS versions but not on Sonoma. On Sonoma application does not come to foreground but instead dock icon starts jumping same way when calling:
[NSApp requestUserAttention: NSCriticalRequest];
And activateWithOptions returns false.
I checked activationPolicy on the app running on Sonoma - it is NSApplicationActivationPolicyRegular
Any ideas how to fix this appreciated.
I'm surprised that you say it worked in Ventura, because in my testing, NSApplicationActivateAllWindows
has not worked since at least 10.15. I filed FB11974786 about it. I worked around it by using the old Carbon function SetFrontProcessWithOptions
, which is deprecated but works.