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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:25:38+00:00 2026-05-25T13:25:38+00:00

Im building api for our rest api using ASIHTTPRequest. Api wraps all requests to

  • 0

Im building api for our rest api using ASIHTTPRequest.

Api wraps all requests to its own methods.

- (void) foo:(id)caller 
     andSuccessCallback:(SEL)successCallback 
     andFailureCallback:(SEL)failureCallback {

    _currentCaller=caller;
    _currentSuccessCallback=successCallback;
    _currentFailureCallback=failureCallback;

    NSString *urlString = @"http://localhost/foo";
    NSURL *url= [NSURL URLWithString: urlString];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDelegate:self];
    [request setDidFinishSelector:@selector(fooSuccess:)];
    [request startAsynchronous];
}

- (void) fooSuccess:(ASIHTTPRequest *)request {
    if (statusCode >=400) {
     if ([_currentCaller respondsToSelector:_currentFailureCallback])
        [_currentCaller performSelector:_currentFailureCallback withObject:statusCode withObject:message];
} else {
    if ([_currentCaller respondsToSelector:_currentSuccessCallback])
        [_currentCaller performSelector:_currentSuccessCallback];
} 
    [request release];
}

Currently to pass callback selector I use class private variables _currentCaller _currentSuccessCallback _currentFailureCallback=failureCallback

Can i pass them to fooSuccess callback directly?

  • 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-05-25T13:25:39+00:00Added an answer on May 25, 2026 at 1:25 pm

    You can pass objects by populating a NSDictionary and setting it as the request’s userInfo property.

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

Sidebar

Related Questions

I'm getting started on building a REST API for a project I'm working on,
Am building a Book search API using Lucene. I need to index Book Name,Author,
I'm building a simple appliacation using the Google Maps API and I'm trying to
I'm building an API using PHP. What do I need to do to recognize
I'm building an API API, it's basically a wrapper for a in house REST
I am building an API, one of its feature is the use of HTTP
I'm building an api using ASP.NET MVC 3. When a controller action is not
I am building an API where the user requests a 'command', which is passed
I am building a JavaScript SDK for our API. The API currently requires (2-legged)
I thought about building a simple API to let users grab some of our

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.