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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:40:42+00:00 2026-06-17T21:40:42+00:00

What I like: Wait until data download completes then open TableView and show data

  • 0

What I like: Wait until data download completes then open TableView and show data.

What I have: When prepareForSegue is called the TableView opens immediately without waiting for the data download although I have a completionBlock (which may not be implemented correctly I guess).

Note: When I go back and open the TableView again I see the data.

- (void)fetchEntries
{
    void (^completionBlock) (NSArray *array, NSError *err) = ^(NSArray *array, NSError *err)
    {
        if (!err)
        {
            self.articlesArray = [NSArray array];
            self.articlesArray = array;
        }
    };

    [[Store sharedStore] fetchArticlesWithCompletion:completionBlock];
}


-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    [self fetchEntries];

    if ([[segue identifier] isEqualToString:@"ShowArticles"])
    {
        TableVC *tbc = segue.destinationViewController;
        tbc.articlesArrayInTableVC = self.articlesArray;
    }

}

Store.m

- (void)fetchArticlesWithCompletion:(void (^) (NSArray *channelObjectFromStore, NSError *errFromStore))blockFromStore
{
    NSString *requestString = [API getLatestArticles];

    NSURL *url = [NSURL URLWithString:requestString];

    NSURLRequest *req = [NSURLRequest requestWithURL:url];

    Connection *connection = [[Connection alloc] initWithRequest:req];

    [connection setCompletionBlockInConnection:blockFromStore];

    [connection start];
}
  • 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-17T21:40:44+00:00Added an answer on June 17, 2026 at 9:40 pm

    You should load your data before you perform a seque.

    - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        // show loading indicator
        __weak typeof(self) weakSelf = self;
        [[Store sharedStore] fetchArticlesWithCompletion:^(NSArray *array, NSError *err)
        {
            [weakSelf performSegueWithIdentifier:@"ShowArticles" sender:weakSelf];
            // hide loading indicator
        }];
    }
    
    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
        // do whatever
    }
    

    Although in my opinion it is much nicer to immediately show the next view controller in response to a user interaction. Have you considered loading your data in the next view controller, instead of waiting for it before you actually want to transition?

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

Sidebar

Related Questions

I have a thread downloading data and I want to wait until the download
I have a UITableView instance tableView that displays data from a server. The tableView
In a console app, an ascii spinner can be used, like the GUI wait
I know it is possible to use jQuery to do something like: $('body').css('cursor','wait'); What
For instance, the app could say something like, Please wait. or I'll be right
Like lots of askers on SO, I'm relatively new to java and have attempted
I have a method like: - (BOOL)shouldDoSomeWork { BOOL result = // here I
I have a PHP script that will generate a report using PHPExcel from data
I have an ipad app that is loading data remotely into core data, I
I'd like to know how multiprocessing is done right. Assuming I have a list

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.