My iPhone application blows up when it accesses an instance variable from within one of the UITableView delegate methods. I think I'm retaining it so I do not understand why I can't access it without a problem.
Here's my .h file
#import <Foundation/Foundation.h>
#import "AlertSummaryCell.h"
#import "AlertDetailViewController.h"
@interface AlertSummaryTableViewController : UITableViewController {
NSDictionary *alerts;
NSString *alertKind;
}
@property (nonatomic, retain) NSDictionary *alerts; @property (nonatomic, retain) NSString *alertKind;
@end
In my .m, the application dies at the first NSLog call:
- (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;
}
What am I missing???
There's no problem at all in the viewDidLoad method:
- (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];
}