views:

23

answers:

2

In the current view that I am in, a button touch-up-inside event leads to the following action:

(Note that while in the Debugger, I've verified that both [self navigationController] and the instantiated historyViewController do indeed exist.

I am unable to determine why this bad access is happening. I can pop/push this view/other views from the navigation controller. Any ideas on how to go about investigating why this view in particular is having problems when getting pushed onto the nav controller?


-(IBAction) viewOrEditHistory: (id) sender {
    HistoryViewController *historyViewController = [[HistoryViewController alloc] initWithStyle:UITableViewStyleGrouped];
    historyViewController.title = @"View or Edit by date";
    historyViewController.sameExSessions = [[NSMutableArray alloc] init];
    historyViewController.exercise = [[Exercise alloc] initWithName:self.title muscleGroup:muscleGroupLabel.text];

/*** EXC_BAD_ACCESS happens after following line is executed ***/
    [[self navigationController] pushViewController:historyViewController animated:YES];
}

Here is my HistoryViewController.h


#import 

@interface HistoryViewController : UITableViewController {

    NSMutableArray *sameExSessions;
    Exercise *exercise;

}
@property (nonatomic, retain) NSMutableArray *sameExSessions;
@property (nonatomic, retain) Exercise *exercise;

-(NSMutableArray *) SameExerciseSessionList;
-(NSString *) getDocPath;
-(NSInteger) tableView:(UITableView *) tableView numberOfRowsInSection: (NSInteger)section;
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath;

@end
A: 

WELL - bad access was caused by a mutable array not being alloc init'd in one of my functions inside the controller. Everyone take note - the debugger does not step into viewDidLoad, viewWillAppear, etc. when originating from a push.

A: 

Please also get your memory management straight or you will run into a lot more problems. Every alloc should be followed by either a release or an autorelease.

mvds