• 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: plist Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plist Problem


  • Subject: Re: plist Problem
  • From: Dave Thorup <email@hidden>
  • Date: Fri, 25 Jul 2003 13:11:09 -0600

On 7/25/03 7:26 AM, "publiclook" <email@hidden> wrote:

> Defaults are normally read once at start-up and cached in memory after
> that. There are options to force an application to reload defaults.
>
> On Friday, July 25, 2003, at 03:21 AM, email@hidden wrote:
>
>> App A is supposed to save a file to the path in the plist. If I run
>> app A and save a file, it saves it at the correct location. But if I
>> run app A, then run app B to change the path, app A still saves the
>> file in the old path. I checked the plist and it has changed, and
>> whenever app A saves a file, it reads the plist. So how can it still
>> be using the old path?
>>
>> If I quit app A, then run it again, it will save it in the correct
>> path. Any ideas?

So it sounds like you're using NSUserDefaults, is that correct? In that
case whenever app A saves a file you should "synchronize" the defaults
before you read from them. Example (warning typed in Mail, test first):

----------------------------
// You've probably already done this somewhere
NSUserDefautls* defaults = [NSUserDefaults standardUserDefaults];

...

// now before you read the path and save, you must synchronize
// with the changes that have been made by app B

NSString* path;

[defaults synchronize];
path = [defaults objectForKey:@"The save path"];

// now save the file
----------------------------

<plug type="shameless">

I've got a great little utility called Defaults Manager that lets you easily
view, edit, add, remove, and backup your user defaults. It's very helpful
when developing your application and testing your code that uses
NSUserDefaults.

http://www.kuwan.net/defaultsmanager

</plug>
____________________________________

Dave Thorup
Software Engineer
email@hidden

www.kuwan.net
Defaults Manager - The premier editor for Mac OS X's User Defaults /
Preferences database.
_______________________________________________
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: plist Problem
      • From: email@hidden
References: 
 >Re: plist Problem (From: publiclook <email@hidden>)

  • Prev by Date: Re: Interfacing with the Real Player or Windows Media?
  • Next by Date: NSTIFFCompressionPackBits not compressing?
  • Previous by thread: Re: plist Problem
  • Next by thread: Re: plist Problem
  • Index(es):
    • Date
    • Thread