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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:52:53+00:00 2026-06-01T18:52:53+00:00

Example: typedef void(^responseBlock)(NSDictionary*, NSError *); @interface MyClass : NSObject { [??] responseBlock responseHandler; }

  • 0

Example:

typedef void(^responseBlock)(NSDictionary*, NSError *);
@interface MyClass : NSObject
{
    [??] responseBlock responseHandler;
}

What qualifier should I put in the [??] brackets?

I’ve read that blocks as properties should be setup with the copy qualifier…but in this case I don’t need the block exposed as a property. I simply want it to remain an ivar but how can I specify copy? And also, without specifying anything what is the default qualifier used? Is it __strong as in the case with everything else?

I’m using ARC on ios5.

  • 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-01T18:52:55+00:00Added an answer on June 1, 2026 at 6:52 pm

    Yes, Blocks are objects in ObjC, so __strong is the appropriate qualifier. Since that’s the default, you can in fact leave it off.

    There’s no way for you to specify that the Block be copied on assignment without a property — that will be your responsibility (responseHandler = [someBlock copy];). You could declare a property that’s only visible to this class itself (not available to other code) by putting a class extension in your .m file:

    @interface MyClass ()
    @property (copy) responseBlock responseHandler;
    @end
    

    This (upon being synthesized) will give you the usual accessor methods, which will take care of the copy for you when you use them.

    Also be aware that it’s possible (and now the recommended procedure) to declare instance variables in the @implementation block. It sounds like you want this to be a private attribute (no property access), and the ivars declared there can’t be seen by any other code. (Of course you don’t need to do this if you’re using a property; @synthesize will create the ivar for you.)

    @implementation MyClass
    {
        responseBlock responseHandler;
    }
    
    // Continue with implementation as usual
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example: #include <stdio.h> typedef void (* proto_1)(); typedef void proto_2(); void my_function(int j){
I have C header file containing the following type definition: // example.h typedef struct
For example, if I have: typedef enum { year, month, day } field_type; inline
Is it possible to typedef long types that use templates? For example: template <typename
Example C API signature: void Func(unsigned char* bytes); In C, when I want to
void f(int){} typedef void (*f_ptr)(int); struct Functor{ void operator()(int){} }; struct X{ operator f_ptr(){
I tried an example live below: typedef struct point { int x; int y;
Question says it all but here is an example: typedef struct mutable_t{ int count,
I have the following typedef: typedef void( __cdecl *tCallback )( const char* Message );
Take the following example: class BookManager { ... }; class Book { public: void

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.