Ios FMDB错误-未知列名

Ios FMDB错误-未知列名,ios,objective-c,sqlite,select,fmdb,Ios,Objective C,Sqlite,Select,Fmdb,我试图使用NSMutableArray在我的tableview中显示来自sqlite数据库的一些数据 当我使用AssetDesc作为我的单元格文本时,我可以从我的UITableCell中的sqlite数据库中看到我的描述。所以我知道一切正常 但是,当我使用AssetName作为我的单元格文本时,我会收到一个sqlite错误,它说: Warning: I could not find the column named 'AssetName'. 如果我更改此行: customer.assetNam

我试图使用
NSMutableArray
在我的tableview中显示来自sqlite数据库的一些数据

当我使用
AssetDesc
作为我的单元格文本时,我可以从我的
UITableCell
中的sqlite数据库中看到我的描述。所以我知道一切正常

但是,当我使用AssetName作为我的单元格文本时,我会收到一个sqlite错误,它说:

Warning: I could not find the column named 'AssetName'.
如果我更改此行:

customer.assetName = [results stringForColumn:@"AssetName"];
像这样:

customer.assetName = [results stringForColumn:@"AssetDesc"];
它工作,所以它必须是我的数据库中的东西,但我不能针点它

但我确信这在我的资产表中。这对我来说很有意义。下面是我的数据库和代码的图片:

-(NSMutableArray *) getCustomers
{
    NSMutableArray *customers = [[NSMutableArray alloc] init];

    FMDatabase *db = [FMDatabase databaseWithPath:[Utility getDatabasePath]];

    [db open];

    FMResultSet *results = [db executeQuery:@"SELECT * FROM asset"];

    while([results next])
    {
        Customer *customer = [[Customer alloc] init];

        customer.assetId = [results intForColumn:@"AssetID"];
        customer.assetName = [results stringForColumn:@"AssetName"];
        customer.assetDesc = [results stringForColumn:@"AssetDesc"];

        [customers addObject:customer];

    }

    [db close];

    return customers;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"CustomerCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    Customer *customer = [self.customers objectAtIndex:[indexPath row]];

    [[cell textLabel] setText:[NSString stringWithFormat:@"%@",customer.assetName]];
    [[cell detailTextLabel] setText:[NSString stringWithFormat:@"%@",customer.assetDesc]];

    return 
}

事实证明,我不得不从设备上删除我的应用程序,然后再次运行。它引用了存储在文档目录中的数据库

我以为它是在引用我的Xcode项目中的数据库


当我从设备上删除应用程序并再次安装时,它显然删除了我文档目录中的文件

当您调试这个时,
[results resultDictionary]
中的键是什么?只是一个旁注:您不会在请求之间打开和关闭数据库,而是创建一个查询,然后在枚举完后关闭查询2013-06-01 23:22:39.840[3759:907]Dict:(“”,“”,“”)这就是你所说的键吗?@RedDeFine除非这些键是
[results resultDictionary]
返回的
NSDictionary
中的键(它们似乎不是,这看起来像是您的
客户
数组),否则就不是。