Ios [\uu NSCFString\u isResizable]:发送到实例0xa7a52e0的无法识别的选择器

Ios [\uu NSCFString\u isResizable]:发送到实例0xa7a52e0的无法识别的选择器,ios,uitableview,sqlite,uiimageview,Ios,Uitableview,Sqlite,Uiimageview,我在数据库中有图像URL字符串。然后检索图像并添加到productimg_数组。我需要将productimg_阵列图像显示到UITableView单元格。我使用的是imageView.image=[UIImage ImageName:[productimg_数组objectAtIndex:indexath.row]]; 但是应用程序崩溃了 const char *sql = "SELECT id,cat_id,product_image,order_by,description FROM pro

我在数据库中有图像URL字符串。然后检索图像并添加到productimg_数组。我需要将productimg_阵列图像显示到
UITableView单元格
。我使用的是imageView.image=[UIImage ImageName:[productimg_数组objectAtIndex:indexath.row]]; 但是应用程序崩溃了

const char *sql = "SELECT id,cat_id,product_image,order_by,description FROM product";

        NSLog(@"sql is %s",sql);

        sqlite3_stmt *statement;

        if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {
            // We "step" through the results - once for each row.



            while (sqlite3_step(statement) == SQLITE_ROW) {


                product_image = [[NSString alloc] initWithUTF8String:
                                 (const char *) sqlite3_column_text(statement, 2)];
              //  NSLog(@"product_image is %@",product_image);

                [productimg_array addObject:product_image];


         }
        }
TableView:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    NSLog(@"productimg_array is %lu",(unsigned long)[productimg_array count]);

    return [productimg_array count];


}




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

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    }


for(int i=0; i<[productimg_array count];i++){

[cell.imageView setImageWithURL:[NSURL URLWithString:[productimg_array objectAtIndex:i]]
               placeholderImage:[UIImage imageNamed:@"placeholder.png"]];


}

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;

}
-(NSInteger)表视图:(UITableView*)表视图行数节:(NSInteger)节{
NSLog(@“productimg_数组为%lu”,(无符号长)[productimg_数组计数]);
返回[productimg_数组计数];
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
静态NSString*CellIdentifier=@“Cell”;
UITableViewCell*单元格=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
如果(单元格==nil){
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault重用标识符:CellIdentifier];
}

对于(inti=0;i,首先需要从URL位置下载该图像,然后必须将其分配给图像视图。为此,可以使用延迟加载

cell.imageView.image = [productimg_array objectAtIndex:indexPath.row];
此处
cell.imageView.image
期望位置中有一个图像,但数组中有一组字符串,您要传递给imageView中的set

 cell.imageView.image =[UIImage imageNamed:[productimg_array objectAtIndex:indexPath.row]];
注意:

product_image = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement, 2)];
如果
产品\u图像
在db中为空或null,则可能会崩溃,因此请执行此操作

char *nameChars = (char *) sqlite3_column_text(statement, 2);
if (nameChars) {
   product_image = [[NSString alloc] initWithUTF8String:nameChars];
}

如何声明
product\u image
它在何处崩溃?删除此行cell.imageView.image=[productimg\u数组objectAtIndex:indexPath.row];这是沃克林,但图像不是showing@user3073276请参阅mu更新的答案。如果productimg_数组有Url字符串,那么它将显示您的图像。最好在这样的场景中使用Lazy Laoding。好的。我想我需要使用SDWebImage。我用SDWebImage更改了代码。但是一个图像显示了所有单元格。