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 9069379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:24:50+00:00 2026-06-16T17:24:50+00:00

I have a problem with my tableview. I am saving all of my data

  • 0

I have a problem with my tableview. I am saving all of my data that I get back from a webservice inside a core database. I implemented a pull down to refresh function for refreshing my tableview. When the app is started the first time all works great. All the data shows up in the tableview and I can refresh as many times as I want.

The problem that I have is that when the app restarts I want that it refreshes the tableview automatically. So I have put this in my viewDidLoad.

- (void)viewDidLoad
{
      [self checkForWIFIConnection];
    if (!self.genkDatabase) {
        NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
        url = [url URLByAppendingPathComponent:@"Default appGenk Database"];
        // url is now "<Documents Directory>/Default Photo Database"
        self.genkDatabase = [[UIManagedDocument alloc] initWithFileURL:url]; // setter will create this for us on disk
    }

     pull = [[PullToRefreshView alloc] initWithScrollView:(UIScrollView *) self.tableView];
    [pull setDelegate:self];
    [self.tableView addSubview:pull];
    [super viewDidLoad];
}

This method is gonna look if there is a database created yet. After this method it goes to the following function UseDocument

- (void)useDocument
{
    if (![[NSFileManager defaultManager] fileExistsAtPath:[self.genkDatabase.fileURL path]]) {
        // does not exist on disk, so create it
        [self.genkDatabase saveToURL:self.genkDatabase.fileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) {
            NSLog(@"no database created yet");
             [self fetchNewsIntoDocument:self.genkDatabase];
           [self setupFetchedResultsController];
        }];
    } else if (self.genkDatabase.documentState == UIDocumentStateClosed) {
        // exists on disk, but we need to open it
        NSLog(@"closed");
        [self.genkDatabase openWithCompletionHandler:^(BOOL success) {
            if([self checkForData] == YES){
                NSLog(@"there is data in viewdidload");
                [self emptyNews];
                [self fetchNewsIntoDocument:self.genkDatabase];
            }
            [self setupFetchedResultsController];

        }];
    } else if (self.genkDatabase.documentState == UIDocumentStateNormal) {
        // already open and ready to use
        [self setupFetchedResultsController];
    }
}

What this method is gonna do, is look at which state the document is. After restart of the app the document is closed. So then I am going to check if there is data. If there is, I am gonna delete all en fetch it all again into the database. This also works.

Problem
What my problem is now is that it only shows the cells that are on that specific moment on screen. So when I scroll down I get empty cells. Like you can see on the screenshot below.

enter image description here

I also get this error.

*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:1054
2012-12-26 09:34:54.831 Krc Genk[24584:c07] CoreData: error: Serious application error.  An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:.  Invalid update: invalid number of sections.  The number of sections contained in the table view after the update (0) must be equal to the number of sections contained in the table view before the update (1), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted). with userInfo (null)

Hope anyone can help me with this.

Kind regards

  • 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-16T17:24:51+00:00Added an answer on June 16, 2026 at 5:24 pm

    The error is well defined, and you should get an idea of where you are getting wrong.
    ITs the number of sections.

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

Sidebar

Related Questions

I have a problem after the data being fetched from Core Data. I filled
I have this problem I've been sitting with. My tableView that I put inside
I have a Core Data backed table view, that show a list of editable
I have problem with deleting rows from my tableView , because I have multiple
I have this problem with a tableview in iOS5 that is giving me errors,
I have a weird problem. I get this error: -[FourSquareCheckInViewController tableView:numberOfRowsInSection:]: unrecognized selector sent
I'm new to iphone development and have this problem with Core Data. At the
I have a problem with my tableview. My first problem is that I have
I have a problem with inserting data to a cell in tableView. When I
I have problem with TableView its empty. In (.h) file: @interface TableViewController : UITableViewController{

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.