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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:43:22+00:00 2026-06-13T08:43:22+00:00

I am iterating through an array of text, with each iteration I am: creating

  • 0

I am iterating through an array of text, with each iteration I am:

  • creating a managed object using initWithEntity:insertIntoManagedObjectContext
  • parsing text
  • determining the display order

With the newly created objects ending up in a tableview.

Because of the super-cool free functionality of the fetchResultsController, cells get automatically inserted into the tableview as insertIntoManagedObjectContext is called.

The problem is there a slight delay in processing the each new object (~20ms) and the order of the lines of text are differently ordered than the tableview that is being updated. This makes the screen flicker as all the cells figure out their display order, with other cells being inserted rapidly behind them. (I can post a video of this effect if this is unclear, I didn’t think it would be this hard to describe it.)

It would be logical to take the lines of text and first parse them into another array, and then insert THAT array into the moc, but I can’t because these are managed objects, and I can’t just alloc them – I have to call initWithEntity:insertIntoManagedObjectContext, which in turn automatically inserts the cells into the tableview.

Taking out the insertRowsAtIndexPaths:withRowAnimation in the didChangeObject method and just calling a reloadData when the iteration was finished didn’t work. (Should it?)

I just want the table not to update until after all the objects have been created.
I can’t see a way to do this with a fetchResultsController, even though it would be trivial without one. As so often follows my questions on SO – what am I missing here?

  • 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-13T08:43:23+00:00Added an answer on June 13, 2026 at 8:43 am

    To stop updates to the table view, you just have to set the fetched results controllers delegate to nil:

    self.controller.delegate = nil;
    

    To resume updates, you set the delegate again, perform an initial fetch, and reload the table data:

    self.controller.delegate = self;
    BOOL success = [controller performFetch:&error];
    [self.tableView reloadData];
    

    performFetch is necessary because the fetched results controller does not track changes to the managed object context while it has no delegate.


    Alternatively, you could also add the data in a background thread, using a second managed object context and save that context only when all data is imported.

    The main thread could register for the NSManagedObjectContextDidSaveNotification of the background thread and call mergeChangesFromContextDidSaveNotification: to refresh the objects.

    In this case, no changes to the fetched results controller are necessary.

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

Sidebar

Related Questions

So we all know that when iterating through a PHP array using foreach, the
I have an associative array and while iterating through this array, using foreach loop.
I'm iterating through an array in ruby with each. Is there an easy way
Is there a way of iterating through an array but performing an operation on
I have been having this issue in iterating through an array of keys and
What's a better way to traverse an array while iterating through another array? For
I am currently iterating through a loop and redimensionalising my array every time I
So I have an array of items, which I am iterating through and grabbing
Often, I am building an array by iterating through some data, e.g.: my_array =
I'm iterating through an array and sorting it by values into days of the

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.