tags:

views:

65

answers:

1

I have a tableview in UIViewController and I want to delete a row of the tableview and also update a sqlite db. While at the edge of the cell deleted my apps get terminated, randomly.

Here is the code in question:

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];

Can any help me?

Thanks in advance....

A: 

This is my code

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];