Hello,
I'm trying to save an array to Core Data. I've been reviewing the following thread: http://stackoverflow.com/questions/537044/storing-custom-objects-in-an-nsmutablearray-in-nsuserdefaults (in particular the answer from Stefan). My code is as follows:
for (TempWorkout *newTempWorkout in items)
{
NSString *strCounterInt = [NSString stringWithFormat:@"%d", counterInt];
newTempWorkout.temp_time = strCounterInt;
newTempWorkout.temp_route = route.text;
newTempWorkout.temp_activity = activity.text;
newTempWorkout.temp_intensity = intensity.text;
NSString *strTotalDistance = [NSString stringWithFormat:@"%.3f", totalDistance];
newTempWorkout.temp_distance = strTotalDistance;
newTempWorkout.temp_mapID = mapID;
[[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:startTimeArray] forKey:@"temp_start_time"];
[self.tempWorkoutArray addObject:newTempWorkout];
}
The above code works, but when I look at my table (via SQLITE Manager in the browser), I don't see any values for key 'temp_start_time'.
Regards, Stephen