• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Preferences are not read
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Preferences are not read
      • From: Quentin Mathé <email@hidden>
References: 
 >Preferences are not read (From: Arthur VIGAN <email@hidden>)

  • Prev by Date: Preferences are not read
  • Next by Date: Re: Preferences are not read
  • Previous by thread: Preferences are not read
  • Next by thread: Re: Preferences are not read
  • Index(es):
    • Date
    • Thread