I have an UITableView that derives its data from an NSArray.  In the same view as the UITableView, there is a UIDatePicker.  When the date in the UIDatePicker changes, then I need to update the NSArray that provides data to the the UITableView and reload the table.
The problem is that I can't figure out how to change the NSArray without crashing my app.  I think that the tableview is tied to the NSArray and if I try to release it then that's what causes the crash.
Here's the method that is called when the UIDatePicker's date is changed:
- (IBAction)datesChanged {
    // Update the availableUnits NSArray
    if (availableUnits != nil) {
        [availableUnits release], availableUnits = nil;
    }
    availableUnits = [self availableUnitsForGivenTime];
    [self.tableView reloadData];
}
What am I missing here?
 
     
    