我在UIViewController中有一个tableview,我想删除tableview的一行并更新一个sqlite db。在删除单元格的边缘时,我的应用程序会随机终止。
以下是相关代码:
NSMutableArray * FeedArr;
NSString *query,*sid;
sid=[[FeedArr objectAtIndex:indexPath.row]objectForKey:@"feedId"];
DB *dbobj=[[DB alloc]init];
query=@"DELETE FROM FEED_MASTER WHERE feedId=?";
[dbobj deleteFromDatabase:sid Query:query];
query=@"DELETE FROM ITEMS_MASTER WHERE feedId=?";
[dbobj deleteFromDatabase:sid Query:query];
[FeedArr removeObjectAtIndex:indexPath.row];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];
能帮助我吗?
提前致谢....
答案 0 :(得分:0)
这是我的代码
NSMutableArray * FeedArr; NSString * query,* sid; sid = [[FeedArr objectAtIndex:indexPath.row] objectForKey:@“feedId”]; DB * dbobj = [[DB alloc] init]; query = @“DELETE FROM FEED_MASTER WHERE feedId =?”; [dbobj deleteFromDatabase:sid查询:查询];
query=@"DELETE FROM ITEMS_MASTER WHERE feedId=?";
[dbobj deleteFromDatabase:sid Query:query];
[FeedArr removeObjectAtIndex:indexPath.row];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];