Re: Preferences are not read
Re: Preferences are not read
- Subject: Re: Preferences are not read
- From: Quentin Mathé <email@hidden>
- Date: Tue, 20 May 2003 15:03:13 +0200
Le mardi, 20 mai 2003, ` 14:15 Europe/Paris, Arthur VIGAN a icrit :
Hi,
My application reads a preference file (which is not the one of the
application) every minutes, and stores the content into an
NSDictionary. I use the following code to read the preference file and
store its content:
if(preferences == nil) // at application launch
preferences = [[NSDictionary alloc]
initWithDictionary:[[NSUserDefaults standardUserDefaults]
persistentDomainForName:@"Application"]];
else // other "loops"
{
[preferences release];
preferences = [[NSDictionary alloc]
initWithDictionary:[[NSUserDefaults standardUserDefaults]
persistentDomainForName:@"Application"]];
}
The problem is that it works well when application launches, but after
the first "loop", the modifications that occure in the preference file
are not read again. Does someone see why?
Defaults values are cached when you read them with for example, this
call :
[[NSUserDefaults standardUserDefaults]
persistentDomainForName:@"Application"]
To update the cached Defaults values, you need to use the following
call :
[NSUserDefaults synchronize]
this message updates the cached Defaults values, and also the system
Defaults database in accordance with the Defaults values you have
altered.
--
Quentin Mathi
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.