SQLite数据库问题

时间:2013-02-06 12:42:55

标签: iphone ios uitableview sqlite

我是iOS开发的新手 我正在开发一个应用程序,它从SQLite数据库读取数据并存储在Shared Instance(单音类)NSMutable Array中。
后来从NSMutableArray我将值分配给Custom Table Cell 但是在运行应用程序时,应用程序终止了消息:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 
'-[Name isEqualToString:]: unrecognized selector sent to instance 0x6824fe0'

以下是cellForRowAtIndexPath的代码的一部分:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"CustomTableViewCell";

CustomTableViewCell *cell = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
    NSArray *nib=[[NSBundle mainBundle] loadNibNamed:@"CustomTableViewCell" owner:self options:nil];
    cell = [nib objectAtIndex:0];
}

cell.menuNameLabel.text=[_hotelMenu._menuList objectAtIndex:indexPath.row];
cell.menuImage.image=[UIImage imageNamed:@"veg.png"];

return cell;
}

1 个答案:

答案 0 :(得分:0)

基本上,您使用Name对象调用isEqualToString。 (不要紧,指针类型是“NSString”,对象是一个Name对象 - Objective-C运行时不关心指针类型。)

所以你需要找出原因。这可能是一个简单的蠢事,或者它可能是一个混乱的存储问题。但对于初学者,您需要实际查看错误消息和应该与其相邻的堆栈tracekback,并确定错误发生的位置,以及因此涉及哪个指针变量。