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

how do I check the defaults for an object?


  • Subject: how do I check the defaults for an object?
  • From: "Alan Smith" <email@hidden>
  • Date: Sat, 27 May 2006 13:17:56 -0400

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
}

But it crashes when it checks the defaults:

2006-05-27 13:11:43.003 EV Manager[555] An uncaught exception was raised
2006-05-27 13:11:43.020 EV Manager[555] *** -[NSCFArray
objectAtIndex:]: index (-1) beyond bounds (0)
2006-05-27 13:11:43.037 EV Manager[555] *** Uncaught exception:
<NSRangeException> *** -[NSCFArray objectAtIndex:]: index (-1) beyond
bounds (0)

How do I get the array without crashing the app?

Thanks, Alan

P.S. I'm using 10.3.0
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
_______________________________________________
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


  • Follow-Ups:
    • Re: how do I check the defaults for an object?
      • From: glenn andreas <email@hidden>
    • Re: how do I check the defaults for an object?
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: region for window draggging
  • Next by Date: Re: region for window draggging
  • Previous by thread: Re: region for window draggging
  • Next by thread: Re: how do I check the defaults for an object?
  • Index(es):
    • Date
    • Thread