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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:14:03+00:00 2026-06-18T21:14:03+00:00

How I do fire a method when I am confident both block codes have

  • 0

How I do fire a method when I am confident both block codes have returned? Like so…

// Retrieve Messages Array from Parse
[ParseManager retrieveAllMessagesForShredderUser:(ShredderUser *)[PFUser currentUser] withCompletionBlock:^(BOOL success, NSError *error, NSArray *objects){
        self.messagesArray = objects;
    }];

// Retrieve MessagesPermissions Array from Parse
[ParseManager retrieveAllMessagePermissionsForShredderUser:(ShredderUser *)[PFUser currentUser] withCompletionBlock:^(BOOL success, NSError *error, NSArray *objects){
        self.messagePermissionsArray = objects;
    }];

-(void)methodToRunWhenBothBlocksHaveReturned{
}
  • 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-18T21:14:05+00:00Added an answer on June 18, 2026 at 9:14 pm

    If you can guarantee that the blocks will be executed on the same thread (i.e., the UI thread), then the alternative is simple, using a __block variable.

    -(void)yourMethod {
        __block int count = 0;
        [ParseManager retrieveAllMessagesForShredderUser:(ShredderUser *)[PFUser currentUser] withCompletionBlock:^(BOOL success, NSError *error, NSArray *objects){
            self.messagesArray = objects;
            count++;
            if (count == 2) {
                 [self methodToRunWhenBothBlocksHaveReturned];
            }
        }];
    
        [ParseManager retrieveAllMessagePermissionsForShredderUser:(ShredderUser *)[PFUser currentUser] withCompletionBlock:^(BOOL success, NSError *error, NSArray *objects){
            self.messagePermissionsArray = objects;
            count++;
            if (count == 2) {
                 [self methodToRunWhenBothBlocksHaveReturned];
            }
        }];
    }
    
    -(void)methodToRunWhenBothBlocksHaveReturned{
    }
    

    If you don’t have the same-thread guarantee, you can use a lock to make sure that the increment of the variable (and the comparison to 2) will be atomic.

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

Sidebar

Related Questions

Why do I have to call new Chart() to fire a method from the
Is there any way to fire a method,when we scroll down from the bottom
I'm trying to use JQuery to have a method fire when the following code
I want to fire some method on voice detection. For Example, Just like in
I'm having trouble getting my delegate method to fire. I have the following code:
I'm using the SDL Tridion event system to fire a method ( OnEmergencyRelease )
I'm trying to fire a Notification in a method called setPosition in one class,
Is it possible to fire event from service to connected clients without request from
I need to fire of a bunch of threads and would like to bring
I am trying to fire a method once a day at a given time.

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.