• 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
Storing preferenses
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Storing preferenses


  • Subject: Storing preferenses
  • From: Eivind Andersen <email@hidden>
  • Date: Mon, 6 Oct 2003 23:56:32 +0200

Hi!

I4m making a Instant Messaging application, where I would like to store
the my own name, the server address and a list containing all the
"buddies", so I don4t have to type them in every time I start the
application

I4m using a NSMutableDictionary, and add the objects that I wish to
save, using the setObject:forKey: method. After that I write the
dictionary to file using: [prefs
writeToFile:[@"~/Library/Preferences/My Client.plist"
stringByExpandingTildeInPath]
atomically: TRUE];

In awakeFormNib i read from this file by using: prefs = [NSDictionary
dictionaryWithContentsOfFile:
[@"~/Library/Preferences/My Client.plist"
stringByExpandingTildeInPath]];

...and take out the various objects with [prefs objectForKey:@"key"]

When I try to extract the buddylist, I use [[[prefs
objectForKey:@"Buddies"]mutableCopy]retain]
but the result is an emtpy array! The array isn4t empty when I (try to)
write it to file!
What am I doing wrong? Can I store and extract an NSMutableArray in
this way?

Best regards,

Eivind Andersen
_______________________________________________
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: Storing preferenses
      • From: Nick Zitzmann <email@hidden>
    • Re: Storing preferenses
      • From: Óscar Morales Vivó <email@hidden>
  • Prev by Date: Re: [OT] serial number validation algorithm?
  • Next by Date: Re: Storing preferenses
  • Previous by thread: Re: different launch methods
  • Next by thread: Re: Storing preferenses
  • Index(es):
    • Date
    • Thread