[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSUserDefaults
From: |
nicola |
Subject: |
Re: NSUserDefaults |
Date: |
Tue, 26 Sep 2000 19:41:01 +0100 (BST) |
> I`m having problems using NSUserDefaults.
> [...]
Hi Rob, as far as I can see, in your example you are only setting user
defaults in the registration domain. (when you use registerDefaults: you
are sort-of-telling the library what defaults you want to be used if no
other defaults are found on disk. It's sort of low-priority defaults in a
volatile domain which are used only if no 'real' defaults are set. They
are not saved to disk because they are not real defaults.).
To set `real' defaults (the ones saved to disk) in your application, you
may try doing something like the following (I just copy an example from
Finger.app):
- (void) set: (id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setObject: [fingerCommand stringValue] forKey: @"FingerCommand"];
[ud setObject: [pingCommand stringValue] forKey: @"PingCommand"];
[ud setObject: [tracerouteCommand stringValue] forKey:
@"TracerouteCommand"];
}
<--><-->
If you perfectly knew about the registration domain and that was not your
problem, your problem could then be that in 0.6.6 applicationWillTerminate
is not correctly called. This problem was recently fixed on CVS.