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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:46:15+00:00 2026-06-17T04:46:15+00:00

I am trying to understand NSOperationQueue’s and am trying to create the most simple

  • 0

I am trying to understand NSOperationQueue’s and am trying to create the most simple example possible. I have the following:

NSOperationQueue *myOQ=[[NSOperationQueue alloc] init];

[myOQ addOperationWithBlock:^(void){
  NSLog(@"here is something for jt 2");
}];
[myOQ addOperationWithBlock:^(void){
  NSLog(@"oh is this going to work 2");
}];

But would like to do this:

void  (^jt)() = ^void(){
  NSLog(@"here is something for jt");
};

void (^cl)() = ^void(){
  NSLog(@"oh is this going to work");
};

NSOperationQueue *myOQ=[[NSOperationQueue alloc] init];

[myOQ addOperation:jt];
[myOQ addOperation:cl];

Is this latter form possible? Can I convert a block to an NSOperation?

thx in advance

  • 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-17T04:46:16+00:00Added an answer on June 17, 2026 at 4:46 am

    You could:

    NSBlockOperation *jtOperation = [NSBlockOperation blockOperationWithBlock:^{
        NSLog(@"here is something for jt");
    }];
    
    NSBlockOperation *clOperation = [NSBlockOperation blockOperationWithBlock:^{
        NSLog(@"oh is this going to work");
    }];
    
    [myOQ addOperation:jtOperation];
    [myOQ addOperation:clOperation];
    

    Having said that, I’d generally do addOperationWithBlock unless I really needed the NSOperation object pointers for some other reason (e.g. to establish dependencies between operations, etc.).

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

Sidebar

Related Questions

Trying to understand what Sql Profiler means by emitting sp_reset_connection. I have the following,
Trying to understand the filter function of AngularJS most of the examples have the
I am trying understand ViewModels deeper and I have read many articles and blogs
Trying to understand why this doesn't work. I keep getting the following errors: left
Trying to understand resources in java-land. I believe the following is true: Resources loaded
Trying to understand why i don't have to convert null to DBNull when using
trying to understand how custom admin commands work, I have my project named mailing
trying to understand methods and virtual function lets say i have 3 classes (the
Trying to understand the new async/await pattern, I have one question which I can't
HI Trying to understand how __radd__ works. I have the code >>> class X(object):

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.