現在、オブジェクトからデータを読み取ろうとしているテーブルビューセルに関してエラーが発生しています。私はデータベースにアクセスし、すべての行をオブジェクトとしてNSMUtable配列に格納しています。これは正常に機能しているようです。しかし、テーブルビューにその配列を読み取らせたい場合は、「null」を取得し続けます。どんな助けでも大歓迎です。
エラー
-[AttendeeData isEqualToString:]:認識されないセレクターがインスタンス0x751ca80に送信されました2013-03-16 11:40:52.499 ExpoRequestLite [39716:c07] *キャッチされない例外「NSInvalidArgumentException」が原因でアプリを終了しています。
@interface DashLandingViewController ()
@end
@implementation DashLandingViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self){
// Custom initialization
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
entries = [[NSMutableArray alloc]init];
_attendeeDataToPush = [[AttendeeData alloc]init];
[self openDB];
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM data"];
sqlite3_stmt *statement;
if(sqlite3_prepare_v2(db, [sql UTF8String], -1, &statement, nil)== SQLITE_OK) {
while(sqlite3_step(statement) == SQLITE_ROW){
NSLog(@"got all attendees");
NSString *firstName = [[NSString alloc] initWithUTF8String:(const char *)sqlite3_column_text(statement, 2)];
_attendeeDataToPush.firstNameValue = firstName;
[entries addObject:_attendeeDataToPush];
NSLog(@"array has %@", [[entries objectAtIndex:0] firstNameValue]);
}
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [entries count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSLog(@"selected firstname is %@", [[entries objectAtIndex:0] firstNameValue]);
cell.textLabel.text = [entries objectAtIndex:indexPath.row];
return cell;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
@end