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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:51:24+00:00 2026-05-19T11:51:24+00:00

In the viewDidLoad() method of view controller I am calling [NSThread detachNewThreadSelector:@selector(readFromFaceBook) toTarget:self withObject:nil];

  • 0

In the viewDidLoad() method of view controller I am calling

[NSThread detachNewThreadSelector:@selector(readFromFaceBook) 
                         toTarget:self 
                       withObject:nil];

readFromFaceBook will pull the data from remote location and populates the data in NSMutabaleArray called “myData”. The view controller contains a tableView which loads data from myData.

The problem I have is, how to delay the execution of tableView delegates until all the data is loaded into “myData” by the thread ..?? The program is crashing as delegate functions are trying to execute using myData . Any help is greatly appreciated…!!!!

  • 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-19T11:51:24+00:00Added an answer on May 19, 2026 at 11:51 am

    You should create the tableview and show it immediately, so the user doesn’t think your app is non-functional. Perhaps a UIProgressIndicator or something to show that you’re doing something?

    Your background thread should be doing the loading, as you’ve correctly chosen. When it’s done, call back to the main thread via something like performSelectorOnMainThread:... or dispatch_async() to the dispatch_get_main_queue(), and invoke [myTableView reloadData] to refresh the UI.

    To prevent the tableview from loading prematurely, there are several approaches you could take. Presumably you’re storing your data in an array, since a UITableView displays ordered data. If so, then just don’t populate the array until the thread finishes. If that doesn’t work, you could just have a BOOL ivar that you use to indicate whether you’ve finished loading, then use the state of the BOOL to determine what you should be showing in your UITableView.

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

Sidebar

Related Questions

In my view controller's -viewDidLoad method, I call [myTextField becomeFirstResponder]; This works like a
In the view controller that has a UITabBarItem, i realized that viewDidLoad() method only
I'm current creating a UISegmentedControl programmatically in a view controller's viewDidLoad method and adding
In my view controller's viewDidLoad method, I create an NSURLConnection NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest
I create a timer in my ViewDidLoad method of my view-controller. NSMethodSignature *sgn =
Some times when I push ViewController into Navigation Controller, the viewDidLoad() method of the
there is a method called viewDidLoad that execute a code when the view is
i have trouble with calling one view controller to another view controller using segue
I'm using NSFetchedResultsController for my table view. I call -performFetch inside my controller's -viewDidLoad
I'm calling a method on a key event which updates a label. [self updateFolderText];

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.