Re: NSUserDefaults Bindings Reset
Re: NSUserDefaults Bindings Reset
- Subject: Re: NSUserDefaults Bindings Reset
- From: Jerry Krinock <email@hidden>
- Date: Tue, 03 Nov 2015 20:31:15 -0800
> On 2015 Nov 01, at 04:58, Michael de Haan <email@hidden> wrote:
>
> NSUserDefaults.standardUserDefaults().removePersistentDomainForName(bundleIdentifier!)
That line of code seems like it is pulling the rug out from under Cocoa Bindings, which might explain why they don’t work.
A better way to reset to default defaults might be to put your default defaults into a plist file in your app’s bundle, get its path with -[NSBundle pathForResource:ofType:], read in to a dictionary with -[NSDictionary dictionaryWithContentsOfFile:] and finally invoke -[NSUserDefaults registerDefaults:], passing the dictionary.
You might also need to remove existing objects using -removeObjectForKey: before you do that. I’ve never tried it.
_______________________________________________
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