Screen saver settings don't take effect (again) under Sonoma
Screen saver settings don't take effect (again) under Sonoma
- Subject: Screen saver settings don't take effect (again) under Sonoma
- From: Gabriel Zachmann via Cocoa-dev <email@hidden>
- Date: Thu, 12 Oct 2023 11:54:05 +0200
IIRC, I had an issue with screen saver settings not taking effect some months
ago (under Ventura), but back then it turned out to be a non-issue.
Now, under Sonoma (14.0), I have an issue with the settings (user defaults) of
my screen saver, again.
I go into System Settings, change some settings of my screen saver, they take
effect immediately in the little Preview window in SysSettings, but when I
click on "Preview" or let the screen saver come on automatically, the new
settings are *not* in effect.
From one user, I heard that the new settings take effect only after rebooting.
So, maybe, something has changed in the way macOS 14.0 handles the
NSUserDefaults, and/or maybe I make an error with using the API. Maybe there is
a bug in macOS 14.0 ?
Below you can find a recap of how I handle the settings using NSUserDefaults.
Interestingly, the same code works fine in a regular app (not screensaver).
I will be very grateful for any kind of suggestions or insights.
Best regards, Gabriel
My screensaver stores different settings for different monitors in the
[NSUserDefaults standardUserDefaults].
To do so, I generate
defaults_ = [NSUserDefaults standardUserDefaults];
Then, I create a dictionary containing the default settings and register them,
like this:
NSDictionary * monitor_defaults = [NSDictionary
dictionaryWithObjectsAndKeys: defaultsForMonitor, displayname, nil ];
[defaults_ registerDefaults: monitor_defaults];
NSDictionary * monitor_user_prefs = [defaults_ dictionaryForKey:
displayname];
Then, I read the actual values from monitor_user_prefs.
When the user changes a setting, I do the inverse, like this:
.. create a new dictionary monitor_user_prefs, containing all the key/value
pairs of the settings ..
[defaults_ setObject: monitor_user_prefs forKey: displayName_];
bool success = [defaults_ synchronize];
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden