kitao / pyxel

A retro game engine for Python
MIT License
14.53k stars 823 forks source link

(MacOS) Version 2.1 displays a warning about the state restoration function when the programme is executed. #542

Closed shiromofufactory closed 1 month ago

shiromofufactory commented 2 months ago

[ warning message ] 2024-06-25 06:29:56.243 Python[14458:2546187] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

As I have no knowledge of this, I asked ChatGPT about this warning and received the following response Is this an effect of some change in version 2.1?

This warning message relates to the development of macOS applications.Specifically, it indicates that a Python script is utilising native macOS functionality and that the security settings related to the State Restore functionality are not enabled. Details are provided below.

NSApplicationDelegate.applicationSupportsSecureRestorableState:. This is a macOS application delegate method that specifies whether the application supports secure state restoration. Secure state restoration is the ability to save the application's state and restore it securely on restart. Cause of warning. This warning is displayed when a Python script behaves like a macOS application and there are no security settings for state restoration. This usually occurs when using a wrapper library (e.g. PyObjC) to utilise native macOS functionality in Python.

kitao commented 2 months ago

Is it possible to check whether the same warning occurs or not in the previous version, Pyxel 2.0?

I couldn't reproduce the warning on my Mac environment for now.

shiromofufactory commented 2 months ago

Version 2.0 did not have this error. It does not affect the operation at the moment, so I will keep an eye on it.

kitao commented 2 months ago

Could you share the version of your macOS and the type of your Mac as well?

shiromofufactory commented 2 months ago

MacBook Air M1, 2020 macOS 14.2(23C64)

kitao commented 2 months ago

I'm using Sonoma 14.5 on M2 mac and can't reproduce it for now.

To Mac users, please let me know your situation (the warning occurs or not and OS version)

nopid commented 1 month ago

SDL2 seems to have a fix for this in a newer version: https://github.com/libsdl-org/SDL/commit/7d25a443c45450287e0a3ec5c1eb0e417647070e

kitao commented 1 month ago

@shiromofufactory @nopid I suppressed the warning before, but it's been degraded accidentally. Now I fixed it again in Pyxel 2.1.6. Please check it.

shiromofufactory commented 1 month ago

@kitao

The warning has disappeared! Thank you very much.