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

  • Home
  • SEARCH
  • 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 8915071
In Process

The Archive Base Latest Questions

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

From a private library, I’m using a block function like this, but don’t know

  • 0

From a private library, I’m using a block function like this, but don’t know how actually they are created. How they will returned back to my class and execute the block ?

ImAnotherClass *sameObj = [[ImAnotherClass alloc] init];

[sameObj testFunctionWithBlock:^(BOOL success, NSError *error) 
{
    if(!error)
    NSLog(@"you'll only read this, once test function was done!");
}];

[sameObj release];

Here, the notable thing is, a testfunction can take good time (in minutes) to complete its execution, but it will perfectly print the line in block ! even my function gets executed already.

  • 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-15T04:53:16+00:00Added an answer on June 15, 2026 at 4:53 am
    //your class .h
     + (void) doSomething:(NSString *) string
                       successCallback:(void (^)(id successValue)) successCallback
             errorCallback:(void (^)( NSString *errorMsg)) errorCallback;
    
    
    //your class.m
    + (void) doSomething:(NSString *) string
                       successCallback:(void (^)(id successValue)) successCallback
             errorCallback:(void (^)( NSString *errorMsg)) errorCallback {
    
       //do your work here
       //set your bool for error
    
        if(error) {
            errorCallback(<error value>);
        } else {
    
    
            successCallback(<value on success>);
        }
    }
    

    make object of your calss and use you dont need sleep it will not let control pass till the block is executed

     [objYourClass  doSomething:(NSString *) string
                               successCallback:(void (^)(id successValue)) successCallback{
        //get your success value
    
        }
                     errorCallback:(void (^)( NSString *errorMsg)) errorCallback{
    //get your error value
        }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I call public method from within private one: var myObject = function() {
I want to return a private field from a remoted object but i get
I need to extract the RSA public key from a RSA private key using
I am currently able to extract a private key from a PFX file using
I have a native library which is invoked by the JNI function called from
I am trying to register a type library programatically from VBA code, using two
I am examining the private c++ function hooking code snippet from mobilesubstrate and see
I'm using FMOD library to extract PCM from an MP3. I get the whole
I was reading this: http://msdn.microsoft.com/en-us/library/tswxhw92(VS.80).aspx The first sentence says: Asymmetric private keys should never
I'm using Hibernate & Joda Time, with support from the UserType library. I'm able

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.