Hi, am writing an application that plots point on a graph and am using the below method to return an array of these points. I have two views, each displaying different graphs but both have this identical method. Whichever graph is used second causes the application to crash when it reaches the line "NSArray *reading ...". I can't figure out why but am guessing it may have something to do with memory management. Does anyone have any ideas how I can solve this?
-(NSArray*)loadPoints{
Vehicle *vehicle = [DataModel theDataModel].currentVehicle;
NSArray *readings = [(NSArray*)vehicle.rVehicleMileage autorelease];
NSSortDescriptor *descriptor = [[[NSSortDescriptor alloc] initWithKey:@"dteDate" ascending:NO] autorelease];
readings = [readings sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]];
return readings;
}
Thanks, William