iPhone Application crashing upon loading a new Detail View
My problem is when trying to load a detail view through a table cell, the application constantly crashes. The error that comes up when running through debug is:
"____TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION_____" objc exception thrown.
If anyone can help me it would be greatly appreciated.
Here is a screenshot for the debug, I am not sure if I am interpreting it right
Image's link.Here is my code where I beleive the error is happening:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
if(self.moreDetailView == nil){
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
self.moreDetailView = dvController;
[dvController release];
}
else{}
moreDetailView.开发者_Python百科title = [NSString stringWithFormat:@"%@", [listOfItems objectAtIndex:row]];
goHerdv2AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.detailView pushViewController:moreDetailView animated:YES];}
You should try putting in some breakpoint(s) before the failure point and then step forward until it crashes.
Then, do it again, watching the value of moreDetailView, delegate, etc. to see if the value changes and/or is defined correctly.
It should become fairly obvious what is going on.
Maybe you forgot to set the view outlet in your nib?
精彩评论