applicationShouldOpenUntitledFile isn't working anymore

I saw this thread https://forums.developer.apple.com/forums/thread/69888 and I need to not open a new default window just because the app is brought to the front without having any windows open. Unfortunately, that isn't working any more under Sonoma 14.5.

Here's my code:

// Let's not open default window just because we're being brought to the front.

-(BOOL)applicationShouldHandleReopen { return NO; }

-(BOOL)applicationShouldOpenUntitledFile { return NO; }

I have breakpoints set on both return statements, but they are never hit.

You're almost there, but the delegate methods you declared don't have the right method signature — they are both expected to take parameters — so your declarations aren't being recognized.

See these documentation pages:

for the correct declarations.

This seems to work, but the applicationShouldOpenUntitledFile method never seems to get called:

// Let's not open default window just because we're being brought to the front.

-(BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)hasVisibleWindows { return NO; }

-(BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender { return NO; }

applicationShouldOpenUntitledFile isn't working anymore
 
 
Q