In the following code, I try to read data from a plist:
-(void)readPreferences
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableArray * myAppDefaults = [defaults mutableArrayValueForKey:@"LastList"];
myCustomObject * savedObject;
NSUInteger i;
for (i = 0; i < [myAppDefaults count]; i++)
{
NSArray * thisArray = [myAppDefaults objectAtIndex:i];
savedObject.value1 = [thisArray objectAtIndex:0];
savedObject.value2 = [thisArray objectAtIndex:1];
savedObject.value3 = [thisArray objectAtIndex:2];
savedObject.value4 = [myAppDefaults objectAtIndex:3];
[objectsArray addObject:savedObject];
}
}
Somehow, when I try to set "savedObject.value1", I get an "EXC_BAD_ACCESS" error.
I realize this is quite likely basic memory management, or pointer/object kind of confusion, but I'm still learning. I hope someone can help me out here. Best regards Sjakelien