Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

NSApplicationDelegate.applicationSupportsSecureRestorableState: Error

WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

Since I upgraded to Sonoma !4.0, VsCode tkinter application stopped and everything is blocked

unable to program further anything with chatgpt

Posted on Oct 1, 2023 1:18 PM

Reply
Question marked as Best reply

Posted on Oct 30, 2023 10:46 AM

Whenever i try to run any python code on sublime text it shows: WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

19 replies

Oct 12, 2023 1:06 PM in response to letaiefB

On Sonoma 14.0, I am receiving the following when trying to launch JMeter or using Intellij both with OpenJdk@11, @17 or @21. I would like some help resolving this: WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.

Nov 24, 2023 9:23 AM in response to letaiefB

You will get that warning even when referencing Tk/Tcl 8.6.12 in Python3 v3.12. If this is a command-line application, simply redirect its stderr to /dev/null (e.g. 2> /dev/null).


#!/usr/bin/env python3

import os
import sys

try:
    import Tkinter as tk      # Python 2
except ImportError:
    import tkinter as tk      # Python 3
	
def main():
	
    # same as 2> /dev/null in the shell
	f = open("/dev/null", "w")
	os.dup2(f.fileno(), 2)
	f.close()

	print("Tcl Version: {}".format(tk.Tcl().eval('info patchlevel')))
	print("Tk Version: {}".format(tk.Tk().eval('info patchlevel')))

	
if __name__ == '__main__':
	sys.exit(main())

Without those first three lines under main(), I get this output when run from the command-line in macOS Sonoma 14.1.1:

Tcl Version: 8.6.12
2023-11-24 12:09:24.253 Python[4114:134228] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
Tk Version: 8.6.12


and after redirecting stderr (2):

Tcl Version: 8.6.12
Tk Version: 8.6.12


This is not specifically a Tk/Tcl issue as I have Python3 apps using PySide Qt 6.5 that cause that warning too until I gag stderr as I have done above.


NSApplicationDelegate.applicationSupportsSecureRestorableState: Error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.