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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:46:22+00:00 2026-05-29T09:46:22+00:00

I am using NSOperationQueue for calling a service in background in viewWillAppear (I also

  • 0

I am using NSOperationQueue for calling a service in background in viewWillAppear(I also tried putting it in viewDidLoad for that matter). I am populating the UITableView based on results I get from service. When I debug the application, the table gets called first and then the operationQueue. In this way the table is empty for me. How to populate the table after operationQueue does its job.

Here is the code :

viewWillAppear :

-(void)viewWillAppear:(BOOL)animated
{
    operationQueue=[[NSOperationQueue alloc] init];
    ParseOperation *obj=[[ParseOperation alloc] initWithMembers:ID];
    [operationQueue addOperation:obj];
    [obj release];

}  
  • 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-29T09:46:23+00:00Added an answer on May 29, 2026 at 9:46 am

    You can add the “reloadTable” as a specific operation with dependency on the parse operation, immediately after the parse operation definition and just before starting the queue (so for safety initialize the queue as suspended and then start it only once all operations have been added):

    
    // ... inside your operation code definition
    NSInvocationOperation *reloadOp = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(myReload) object:nil];
    [reloadOp addDependency:obj] // adding here the parse operation as a dependency
    [operationQueue addOperation:reloadOp];
    

    The “myReload” operation needs to be defined as a stand-alone method in order to ensure that the reloadTable method is called in the main thread:


    -(void)myReload {
    [table performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
    }

    In this way your reload code will be run only after the parse operation terminates. This is useful if you have more operations to be run and all them needs to be executed before the table reload. Note that the dependency is unaware of the fact that the operation terminated normally or has been cancelled.

    Another good way you may consider is to define a GCD serial queue and add the two blocks in sequence (first block is parsing, second block is table reload). In such case GCD will guarantee the proper execution order of the two blocks (FIFO).

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

Sidebar

Related Questions

Hello i am using NSOperationQueue to download images in the background. I have created
I have a project which downloads images in background using NSOperationQueue . It was
I am using an UITableView to show some string messages, and I use NSOperationQueue
I am trying to perform a method in a background thread using a NSOperationQueue
I'm using NSOperationQueue , and NSOperation for running some function on background click. But
I want to setup a serialized task queue using NSOperationQueue but I'm a little
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I was told that using the -> in that way will keep my UI
I'm using NSOperationQueue's addOperationWithBlock. From within the block, how do I check to see

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.