Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8328557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:29:00+00:00 2026-06-09T01:29:00+00:00

when I try to remove a cell from my UITableView it gives me this

  • 0

when I try to remove a cell from my UITableView it gives me this error:

*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:1046
2012-08-02 16:35:13.941 jsontest2[1551:f803] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (4) must be equal to the number of rows contained in that section before the update (4), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
*** First throw call stack:
(0x13e0052 0x1571d0a 0x1388a78 0x9c02db 0xbb518 0xc6211 0xc623f 0x2ce9 0xd289d 0x226d70 0x13e1ec9 0x3a5c2 0x3a55a 0xdfb76 0xe003f 0xdf2fe 0x5fa30 0x5fc56 0x46384 0x39aa9 0x12cafa9 0x13b41c5 0x1319022 0x131790a 0x1316db4 0x1316ccb 0x12c9879 0x12c993e 0x37a9b 0x1c22 0x1b95)
terminate called throwing an exception**

Here’s my code:

- (void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath 
{
    [tabela beginUpdates]; 
    if (editingStyle == UITableViewCellEditingStyleDelete) 
    {
        // Get the TAG and ID of Bill to delete
        //UITableViewCell * cell = [self tableView:tabela cellForRowAtIndexPath:indexPath];
        //NSLog(@"%d", cell.tag);

        [tabela deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:YES];      

    }   

    [tabela endUpdates];
    [tabela reloadData];

}

Thanks for the help!

EDIT

self.billsArray = [[NSMutableArray alloc] init];
self.billsArray = [resultsDictionary objectForKey:@"bills"];

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:29:01+00:00Added an answer on June 9, 2026 at 1:29 am

    In your billsArray, make sure and remove the corresponding object that is being deleted.

    [billsArray removeObjectAtIndex:indexPath.row];
    

    Here is the hint from the output:

    The number of rows contained in an existing section after the update
    (4) must be equal to the number of rows contained in that section
    before the update (4), plus or minus the number of rows inserted or
    deleted from that section (0 inserted, 1 deleted) and plus or minus
    the number of rows moved into or out of that section

    So your UITableView is pretty much saying:

    “Ok, I have 20 rows (which comes from [billsArray count]. Now I’m
    suppose to delete one row which means I should have 19 rows
    total….But my delegate is saying I should have 20 rows…Whhhattt
    dooo I dooo??? …..crash ” – UITableView

    So make sure and remove the object from your data array whenever you delete a row. OR if you add a row, make sure and add it to your data array.

    EDIT:
    (In response to OP edit).

    There is your problem.

    self.billsArray = [resultsDictionary objectForKey:@"bills"]; 
    

    This creates a read-only array.

    What you need to do is this:

    self.billsArray = [[NSMutableArray alloc] initWithArray:[resultsDictionary objectForKey:@"bills"]];
    

    Or

    self.billsArray = [NSMutableArray arrayWithArray:[resultsDictionary objectForKey:@"bills"]];
    

    Or you could do (not a clean method):

    NSMutableArray *temp = [resultsDictionary objectForKey:@"bills"];
    self.billsArray = [temp mutableCopy];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to remove my PHP extensions from all my files using my
So, if I try to remove elements from a Java HashSet while iterating, I
I know i will get this exception when i try to modify or remove
I try to remove entities from a collection but it doesn't work. I think
I try to remove seconds from date: >>> import datetime >>> test1 = datetime.datetime(2011,
I try to remove the buttons in one of my view controllers, somehow this
I try to remove some XmlElements from my Xml file in C#2.0. I can
I'm using the .remove() function from within jQuery to try and remove a form
I have a UIView and try to remove it from its superview using an
I get Concurrent Modification Exception when i try to remove an item from HashMap.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.