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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:12:12+00:00 2026-06-12T12:12:12+00:00

I have NSOperationQueue with 3 NSInvocationOperation in a prepareForSegue callback and I need after

  • 0

I have NSOperationQueue with 3 NSInvocationOperation in a prepareForSegue callback and I need after finishing all async tasks move to another view controller.
How can I be notified about finishing all async tasks and only after this move to another screen?

I tried this without success:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

});

EDIT:

It seems that I not understand something :

-(void)initPurchase{

    [operationQueue cancelAllOperations];

    NSInvocationOperation *downloadImageOperation = [[NSInvocationOperation alloc] initWithTarget:[BSImageDownloader getInstance] selector:@selector(downloadImageSync:) object:@"http://.........jpg"];


    NSInvocationOperation *createImageOperation = [[NSInvocationOperation alloc] initWithTarget:[BSImageCreator getInstance] selector:@selector(createImage:) object:@"dsadsadsa"];


    NSInvocationOperation *saveImageOperation = [[NSInvocationOperation alloc] initWithTarget:[BSImageSaver getInstance] selector:@selector(saveImageAsPng:) object:[BSSharedObject getInstance].createdImage];

    [createImageOperation addDependency:downloadImageOperation];
    [saveImageOperation addDependency:createImageOperation];


    [operationQueue addOperation:downloadImageOperation];
    [operationQueue addOperation:createImageOperation];
    [operationQueue addOperation:saveImageOperation];


}


-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{

    [[BSPopupManager getInstance]showWaitingPopup];


    dispatch_group_t group = dispatch_group_create();

    dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), 
                         ^{
                             Purchase *purchase = [[Purchase alloc] init];
                             [purchase initPurchase];
                         });

    dispatch_group_notify(group, dispatch_get_main_queue(), ^{
        [[BSPopupManager getInstance] closeWaitingPopup];
        BSPurchaseViewController *purchaseViewController = [segue destinationViewController];
        purchaseViewController.pngImage = [BSSharedObject getInstance].createdImage;


 NSLog(@"2");
    });

    dispatch_release(group);

}
}

I still get NSLog(@”2″); earlier than I save image in 3rd NSInvocationOperation

  • 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-12T12:12:13+00:00Added an answer on June 12, 2026 at 12:12 pm

    You can use the dispatch_group_async() function if you intend to use GCD to perform your asynchronous tasks: Grand Central Dispatch (GCD) Reference

    dispatch_group_t group = dispatch_group_create();
    
    dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), 
    ^{
         //Code here is executed asynchronously
    });
    
    dispatch_group_notify(group, dispatch_get_main_queue(), 
    ^{
       //Do something when async has completed
       //Note: You are not required to use the main 
       //queue if you aren't performing any UI work.
    });
    
    dispatch_release(group);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a view controller that has an NSOperationQueue as an instance variable,
I have a custom view controller that implements the from UITableViewDataSource and UITableViewDelegate protocols.
In my application, I'm using NSOperationQueue and NSInvocationOperation objects to execute all the operations.
I have this piece of code: - (id) getSearchSuggestions:(NSString*)q; - (NSOperationQueue*) getSearchSuggestions:(NSString*)q callback:(id<UserDelegate>)callback; -
The Problem I have an NSOperationQueue called logEntryGeneratorQueue I want to wait until all
I have a view which loads data via an NSOperation within an NSOperationQueue. I
I have an NSOperationQueue to which i have added my custom class's objects(inherits from
I have a weird issue. Here is the setup: I have a NSOperationQueue which
I have UITextView logView (tried both atomic and nonatomic ) and NSOperationQueue uploadQueue properties
Hello i am using NSOperationQueue to download images in the background. I have created

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.