• 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: how do I check the defaults for an object?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do I check the defaults for an object?


  • Subject: Re: how do I check the defaults for an object?
  • From: glenn andreas <email@hidden>
  • Date: Sat, 27 May 2006 14:58:16 -0500


On May 27, 2006, at 12:17 PM, Alan Smith wrote:

Hey,
I need to get an array from UserDefaults but the first time this app
is run there won't be that array. That's not the only time either. So,
I need to check to see if that array exists so the app doesn't crash,
the way it does now. I've tried this:

if ([[NSUserDefaults standardUserDefaults] objectForKey:[[otherTable
selectedPilot] name]])
{
      //Code creating the array
}

Your code appears to be backwards - the "code creating the array" will be hit if the object already exists (and if it doesn't exist, it appears that it may never get created).


Not sure if that's your entire problem - the easiest way is to break when the exception is thrown and see exactly where in your code some parent of it came from...

Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures, fractals, art



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >how do I check the defaults for an object? (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Newbie Q : automatic creating & saving
  • Next by Date: Text Editor mini-toolbar like BBEdit or Xcode
  • Previous by thread: Re: how do I check the defaults for an object?
  • Next by thread: You can give propertyListFromData: a C string!
  • Index(es):
    • Date
    • Thread