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

The Archive Base Latest Questions

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

I have a method that accepts a block and a completion block. The first

  • 0

I have a method that accepts a block and a completion block. The first block should run in the background, while the completion block should run in whatever queue the method was called.

For the latter I always used dispatch_get_current_queue(), but it seems like it’s deprecated in iOS 6 or higher. What should I use instead?

  • 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-13T21:17:41+00:00Added an answer on June 13, 2026 at 9:17 pm

    The pattern of “run on whatever queue the caller was on” is appealing, but ultimately not a great idea. That queue could be a low priority queue, the main queue, or some other queue with odd properties.

    My favorite approach to this is to say “the completion block runs on an implementation defined queue with these properties: x, y, z”, and let the block dispatch to a particular queue if the caller wants more control than that. A typical set of properties to specify would be something like “serial, non-reentrant, and async with respect to any other application-visible queue”.

    ** EDIT **

    Catfish_Man put an example in the comments below, I’m just adding it to his answer.

    - (void) aMethodWithCompletionBlock:(dispatch_block_t)completionHandler     
    { 
        dispatch_async(self.workQueue, ^{ 
            [self doSomeWork]; 
            dispatch_async(self.callbackQueue, completionHandler); 
        } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method that accepts a sender and is called with a UIbutton.
I have a method that accepts a generic delegate as a parameter, and inserts
I have a method that accepts an IEnumerable-decimals and performance various math functions. I
I have a method Foo4 that accepts a parameter of the type Func<>. If
When writing a method that accepts a block as an argument, do I need
I have a static method that accepts a couple of parameters. Inside the method
We have a class that wraps NSURLConnection. It accepts a block that it calls
I have a method that accepts a bunch of strings in seperate parameters public
I have a service method that accepts CultureInfo object as a parameter. I want
I have a method that accepts a String argument. The String could contain an

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.