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

  • SEARCH
  • Home
  • 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 1055391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:33:18+00:00 2026-05-16T17:33:18+00:00

I have a sectioned UITableView using dictionaries adapting code from a tutorial (I don’t

  • 0

I have a sectioned UITableView using dictionaries adapting code from a tutorial (I don’t have a link on me at the moment but I can dig it up if you really need it).

Anyway I’m trying to have it delete an item from the list when I get this error (warning: its long)

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 (2) must be equal to the number of rows contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted).

I Kind of get the information about the number of rows but I’m nut sure how to fix this.

If you want to see the debugger information I paste-binned it because its so long: http://pastebin.com/0difSEnM

Here’s my code:

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)index {
 NSDictionary *dictionary = [data objectAtIndex:index.section];
 NSMutableArray *array = [NSMutableArray arrayWithArray:[dictionary objectForKey:@"My Wishlists"]];
 NSString *selectedWishlist = [array objectAtIndex:index.row];
 //now remove the item
[array removeObjectAtIndex:index.row];
 [data removeObjectAtIndex:index.section];
 NSDictionary *newdictionary = [NSDictionary dictionaryWithObject:[NSArray arrayWithArray:array] forKey:@"My Wishlists"];
 [data insertObject:newdictionary atIndex:0];
// [data addObject:newdictionary];
 [mainTableView reloadData]; // tried without and with this, no difference
 [mainTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:index] withRowAnimation:UITableViewRowAnimationTop];
}

Thanks!
Christian Stewart

  • 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-05-16T17:33:19+00:00Added an answer on May 16, 2026 at 5:33 pm

    Looks like this is your problem:

    [data insertObject:newdictionary atIndex:0];
    

    From the docs for NSMutableArray’s insertObject:atIndex::

    Discussion If index is already
    occupied, the objects at index and
    beyond are shifted by adding 1 to
    their indices to make room.

    Try using replaceObjectAtIndex:withObject: instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The MySQL SELECT syntax is: SELECT [ALL | DISTINCT |… May 17, 2026 at 1:44 am
  • Editorial Team
    Editorial Team added an answer We have been tuning ORMLite on Android for a while… May 17, 2026 at 1:44 am
  • Editorial Team
    Editorial Team added an answer The following execute once the document has been loaded: $(function(){… May 17, 2026 at 1:44 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a UITableView that's populated using core data & sqlite. I'd like to
I have an application that has a UITableView. This UITableView is populated by an
I'm trying to use a UITableView without using a nib and without using a
I have a UITableView with two sections, which are both empty when my application
I have a grouped UITableView, with cells in section 2 depending on cells in
I'm using an NSFetchedResultsController in a standard way to update a UITableView whenever something
I have a problem that I had working in a test but now in
I have setup Core Data for an iPhone app without an instance of NSFetchedResultsController.
I have a problem and lots of difficulty finding a solution, even if I
I have this bizarre problem. I'm making a checklist program with XCode and I'm

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.