how do I check the defaults for an object?
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