Re: Preventing app from being restored or saving info in "Saved Application State"
On Nov 10, 2019, at 17:39 , Lars C. Hassing via Cocoa-dev wrote: > > I believe data in "~/Library/Saved Application State" is being used for this, > how can I programmatically in app two tell that restoration is not useful ? > > I’ve tried myMainWindow.restorable = NO. The thing that’s relaunching your app isn’t state restoration, which is only about restoring state of and within windows. If you’re talking about the “Reopen” button in the dialog that says your app crashed, I think that’s CrashReporter or some similar system component, and I’m not aware of any way of controlling the buttons it offers you. So, the answer depends on what you’re asking. — If you’re asking whether it’s possible to suppress the option to relaunch the crashed app, then no, I don’t believe there is. — If you’re asking whether it’s possible for the app to suppress state restoration, if it’s launched via *any* unexpected mechanism, then I think you’re barking up the wrong tree. It’s just as wrong for your app to relaunch without state restoration as it to relaunch with state restoration. You would need to find a way of detecting that it was not launched by the correct base app (e.g. inter-process communication with that app, if it’s running), but I doubt there’s any built-in thing you could use for that either. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Preventing app from being restored or saving info in "Saved Application State"
i too have this question > On Nov 10, 2019, at 5:39 PM, Lars C. Hassing via Cocoa-dev > wrote: > > I have developed two Cocoa apps, one launching the other helper app. > > If number two app crashes then macOS may ask the user if he wants to relaunch > it, > but it makes no sense launching it on its own, because it must be launched in > a controlled manner and environment from the first app. > > I believe data in "~/Library/Saved Application State" is being used for this, > how can I programmatically in app two tell that restoration is not useful ? > > I’ve tried myMainWindow.restorable = NO. > > > I’ve learned that you can do > defaults write com.mycompany.myapp2 NSQuitAlwaysKeepsWindows -bool false > but I cannot ask users to open Terminal. > > Maybe I could use > [NSUserDefaults.standardUserDefaults setBool:NO forKey:@“ > NSQuitAlwaysKeepsWindows”]; > but i hope there is another way > /Lars ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Preventing app from being restored or saving info in "Saved Application State"
I have developed two Cocoa apps, one launching the other helper app. If number two app crashes then macOS may ask the user if he wants to relaunch it, but it makes no sense launching it on its own, because it must be launched in a controlled manner and environment from the first app. I believe data in "~/Library/Saved Application State" is being used for this, how can I programmatically in app two tell that restoration is not useful ? I’ve tried myMainWindow.restorable = NO. I’ve learned that you can do defaults write com.mycompany.myapp2 NSQuitAlwaysKeepsWindows -bool false but I cannot ask users to open Terminal. Maybe I could use [NSUserDefaults.standardUserDefaults setBool:NO forKey:@“ NSQuitAlwaysKeepsWindows”]; but i hope there is another way /Lars ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com