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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:18:06+00:00 2026-06-11T18:18:06+00:00

I am asynchronously loading data to an array in a getter method of data.

  • 0

I am asynchronously loading data to an array in a getter method of data.

First of all it produces an empty array, so naturally my table loads 0 rows.

When the data is finished loading, I call reloadData to update my table, however, there seems to be ~6 second gap between the data being downloaded and the UITableView showing the data.

Does anyone know any reasons this might happen?

I use the dispatch_async method with a priority of high.

I’ve even logged each point in the process of loading the data and inserting the data, and it shows this.

Also, if I keep scrolling the table up and down as it’s data is being loaded, the table shows its data as soon as it should, rather than have this gap between insertion.

Code:

- (NSMutableDictionary *)tableDictionary {
    if (!_tableDictionary) {
        _tableDictionary = [NSMutableDictionary dictionary];

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
            NSString *URLString = @"http://www.urlToData.com/path/to/file.php?foo=bar";

            NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:URLString]];
            NSError *error = nil;

            NSDictionary *objectIDs = [NSJSONSerialization JSONObjectWithData:data options:NSJSONWritingPrettyPrinted error:&error];

            NSMutableDictionary *objects = [NSMutableDictionary dictionary];

            for (NSInteger i = 0; i < objectIDs.allValues.count; i++) {
                NSArray *eventIDs = (objectIDs.allValues)[i];
                NSString *eventType = (objectIDs.allKeys)[i];

                [objects setValue:[myObject initWithIDs:objectIDs] forKey:@"key"];
            }

            self.tableDictionary = objects;
            self.titlesForSectionHeader = objects.allKeys;

            NSLog(@"Done");
            [self.tableView reloadData];
        });
    }
    return _tableDictionary;
}
  • 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-11T18:18:07+00:00Added an answer on June 11, 2026 at 6:18 pm

    Try reloading your tableview’s data on the main thread like this:

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
            //background processing goes here
            //This is where you download your data
            dispatch_async(dispatch_get_main_queue(), ^{
                //update UI here
                [self.tableView reloadData];
            });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

View model is loading data asynchronously using background worker thread in model. All properties
Getting a strange problem when loading the twitter widget asynchronously on IE. It loads
All, We are having problems with data loading in our application. The purpose of
I have tried many ways of Asynchronously loading images and they ALL have this
I'm loading data from a server and processing the response asynchronously. Using NSURLConnection. Each
So I have a UIViewController which loads data asynchronously using NSOperationQueue . I had
I'm asynchronously loading the FB JS SDK for a website that features some sharing
I'm loading pages asynchronously with the jQuery load function, like this: tree.click(function() { if
I have an interesting problem. I am loading a UITableView asynchronously. I am trying
I have a jQuery application that loads data from five asynchronous server calls. I

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.