Setting a prefs value at quit time
Setting a prefs value at quit time
- Subject: Setting a prefs value at quit time
- From: Graham Cox <email@hidden>
- Date: Fri, 06 May 2016 09:38:00 +1000
I have a problem when my app quits on 10.9 (OK on 10.11):
0 __pthread_kill 10
1 abort 125
2 -[CFPrefsPlistSource alreadylocked_setValue:forKey:] 174
3 -[CFPrefsSource setValue:forKey:] 69
4 +[CFPrefsSource withSourceForIdentifier:user:byHost:container:perform:] 839
5 _CFPreferencesSetValueWithContainer 215
6 -[NSUserDefaults setObject:forKey:] 38
I set a value in NSUserDefaults on receiving the ‘app will quit’ notification. As you can see, there’s an issue where some internal check aborts because… well, not sure: ‘already locked’???
Is there some reason that a prefs value can’t be written at quit time? This only seems to cause this problem on 10.9, 10.11 is fine, haven’t tested on 10.10 yet. I also don’t think this was ever an issue on older OS either - this particular code is pretty old.
If it’s NOT legal to write a prefs value at quit time, how is one supposed to record persistent state that is only final by that time?
—Graham
_______________________________________________
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