SnK
SnK

Reputation: 528

Set different callback with ASIHTTPRequest

For an app i'm currently making i use the ASIHTTPRequest API to do my communication:

    NSURL *url = [NSURL URLWithString:@"http://testService.com"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request appendPostData:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];

[request addRequestHeader:@"Content-Type" value:@"application/json"];
[request setTimeOutSeconds:20.0f];
[request setRequestMethod:@"POST"];

NSData * postData = [NSJSONSerialization dataWithJSONObject:dictionnary2 options:0 error:nil];

[request setPostLength:[postData length]];

[request appendPostData:postData];

[request setDelegate:self];
[request startAsynchronous];

i already have working calls in place but they both go to the same callback method : - (void)requestFinished:(ASIHTTPRequest *)request

I want each call to have it's own callback method since i call one call from the callback method of the other. How can i do this ?

Upvotes: 0

Views: 398

Answers (1)

nik
nik

Reputation: 2329

In this kind for situation i would always prefer to use Blocks for call backs.

Check this link for block implementation methods and design,

Upvotes: 1

Related Questions