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

nsuserdefaults woes


  • Subject: nsuserdefaults woes
  • From: "Rick C." <email@hidden>
  • Date: Sun, 30 Aug 2009 04:59:32 -0700 (PDT)

hello again,

hoping someone can shed some light on what i might be doing wrong here.  i'm trying to read, compare, and possibly edit a shared plist in which the entry i'm interested in is an array which goes a bit deep.  here's what i'm doing so far:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults addSuiteNamed:@"com.mycompany.mysharedapp"];
NSArray *myDefaultsArray = [defaults arrayForKey:@"mynestedarray"];

this normally returns an array with the info i need and then i do an object enumerator and run through the array using valueForKey on each item in the array getting exactly the values i need, and then i copy over the array items i want to keep to a new array.  my plan was to write this new array back to my plist which would give me the new values.  i couldn't quite figure out how to accomplish this as setObjectForKey didn't seem to make it work.  I also tried to removeObject first and then write the new array in without success.  the strangest thing of all is now after my experimenting my initial code that i posted above no longer returns the info i need to start with but only an empty array.  even after removing and creating a new plist and confirming that the values are actually there my code continues to give me an empty array.  can anyone suggest to me what i might be doing wrong and if there's an easier way to do this?  thank you,

rick



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: nsuserdefaults woes
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: x86_64 "Symbol not found" problem
  • Next by Date: SCNetworkReachability and impact of Snow Leopard
  • Previous by thread: Re: x86_64 "Symbol not found" problem
  • Next by thread: Re: nsuserdefaults woes
  • Index(es):
    • Date
    • Thread