0

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 ?

SnK
  • 528
  • 1
  • 11
  • 32

1 Answers1

1

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

Check this link for block implementation methods and design,

nik
  • 2,289
  • 6
  • 37
  • 60