开发者

Pushing UITableViewController onto [self navigationController] causes an EXC_BAD_ACCESS

开发者 https://www.devze.com 2023-01-07 05:54 出处:网络
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 instanti

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.sameE开发者_如何学PythonxSessions = [[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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消