0

在我在,按鈕觸摸擡起-內部事件導致以下動作的當前視圖:推的UITableViewController到[自我navigationController]導致EXC_BAD_ACCESS

(請注意,雖然在調試器,我VE證實,雙方[自我navigationController]和實例historyViewController確實存在。

我無法確定爲什麼這種不良的訪問發生的事情。我可以彈出/從導航控制器推這個觀點/其他意見。關於如何去調查爲什麼這個特別是在推入導航控制器時遇到問題?


-(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]; 
} 

這裏是我的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 

回答

0

也請讓您的內存管理直,否則你會碰到很多問題更多。每個分配都應該有一個釋放或一個自動釋放。

+0

事實上,不穩定的內存管理是導致問題的原因。謝謝! – Eitan 2011-10-27 14:33:47

相關問題