Obteniendo "EXC_BAD_ACCESS" al acceder a la variable de instancia desde dentro del método delegado de UITableView
Mi aplicación de iPhone explota cuando accede a una variable de instancia desde uno de los métodos de delegado de UITableView. Creo que lo estoy reteniendo, así que no entiendo por qué no puedo acceder a él sin problemas.
Aquí está mi archivo .h
#import <Foundation/Foundation.h>
#import "AlertSummaryCell.h"
#import "AlertDetailViewController.h"
@interface AlertSummaryTableViewController : UITableViewController {
NSDictionary *alerts;
NSString *alertKind;
}
@property (no atómico, retener) NSDictionary * alertas; @ propiedad (no atómica, retener) NSString * alertKind;
@fin
En mi .m, la aplicación muere en la primera llamada de NSLog:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"AlertSummaryTableViewController.numberOfRowsInSection entered");
NSLog(@" alerts description = %@", [alerts description]);
// To know how many alert summaries we have, get the value for count out of the input dictionary
int theCount = [[alerts objectForKey:@"count"] intValue];
NSLog(@" Going to return %d",theCount);
return theCount;
}
¿¿¿Qué me estoy perdiendo???
No hay ningún problema en absoluto en el método viewDidLoad:
- (void)viewDidLoad {
NSLog(@"AlertSummaryTableViewController.viewDidLoad entered");
NSLog(@" alerts description = %@", [alerts description]);
// We want the View title to include the alert count
// To know how many alert summaries we have, get the value for count out of the input dictionary
int theCount = [[alerts objectForKey:@"count"] intValue];
// Now construct the title text and set our views title to it
NSString *myTitle = [[NSString alloc] initWithFormat:@"%@ Alerts (%d)",alertKind,theCount];
[self setTitle: myTitle];
// Memory cleanup
[myTitle release];
[super viewDidLoad];
}