Re: Setting a prefs value at quit time
Re: Setting a prefs value at quit time
- Subject: Re: Setting a prefs value at quit time
- From: Alex Zavatone <email@hidden>
- Date: Thu, 05 May 2016 20:03:26 -0400
Isn’t there a sudden termination option to allow this for this exact purpose? Or would there be an application delegate method that would allow the application to quit? When a quit is issued, make sure that the can quit returns NO and after the prefs are written, change that value to YES and reissue the quit.
Just a few thoughts.
On May 5, 2016, at 7:38 PM, Graham Cox <email@hidden> wrote:
> 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
_______________________________________________
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