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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:41:53+00:00 2026-06-11T17:41:53+00:00

Obj-C blocks are something I’m just using for the first time recently. I’m trying

  • 0

Obj-C blocks are something I’m just using for the first time recently. I’m trying to understand the following block syntax:

In the header file:

@property (nonatomic, copy) void (^completionBlock)(id obj, NSError *err);

In the main file:

-(void)something{

id rootObject = nil;

// do something so rootObject is hopefully not nil

    if([self completionBlock])
        [self completionBlock](rootObject, nil); // What is this syntax referred to as?
}

I appreciate the assistance!

  • 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-11T17:41:54+00:00Added an answer on June 11, 2026 at 5:41 pm

    Its a block property, you can set a block at runtime.

    Here is the syntax to set

    As it is void type, so within the class you can set a method by following code

    self.completionBlock = ^(id aID, NSError *err){
        //do something here using id aID and NSError err
    };
    

    With following code you can call the method/block set previously.

    if([self completionBlock])//only a check to see if you have set it or not
    {
            [self completionBlock](aID, nil);//calling
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm trying to learn C++ and I've gotten as far as using header
For few days I'm trying to compile one project written in C++ using Code::Blocks
I've started using blocks, and one of the first things I encountered is an
I can't figure out the proper block initialize class Foo attr_accessor :bar end obj
You'll appreciate the following two syntactic sugars: lock(obj) { //Code } same as: Monitor.Enter(obj)
I'm a C newbie and I was just trying to write a console application
I'm trying to create a little Ruby hack to make something like the reverse
Take the following code as a sample: procedure TForm1.Button1Click(Sender: TObject); var Obj: TSomeObject; begin
I'm trying to render collection result in some of pages. What I understand is
I'd like to recursively call a block from within itself. In an obj-c 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.