私のiPhoneアプリケーションは、UITableViewデリゲートメソッドの1つからインスタンス変数にアクセスすると爆発します。保持していると思うので、なぜ問題なくアクセスできないのかわかりません。
これが私の.hファイルです
#import <Foundation/Foundation.h>
#import "AlertSummaryCell.h"
#import "AlertDetailViewController.h"
@interface AlertSummaryTableViewController : UITableViewController {
NSDictionary *alerts;
NSString *alertKind;
}
@property(nonatomic、retain)NSDictionary * alert; @property(非アトミック、保持)NSString * alertKind;
@終わり
私の.mでは、アプリケーションは最初の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;
}
私は何が欠けていますか?
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];
}