0
votes

I am using ASIFormDataRequest to send http requests but they all go to the same function requestFinished. Inside this function how can I know from which request it came from? Is there any way for me to add some kind of tag name to request that comes in?

I would prefer to use one function and have a switch statements instead of having two functions per http requests and manually setting the functions [request setDidFailSelector:@selector(requestFailed:)]; [request setDidFinishSelector:@selector(requestFinished:)];

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setDelegate:self]; [request startSynchronous];

  • (void)requestFinished:(ASIHTTPRequest *)request
1

1 Answers

1
votes

You could subclass ASIFormDataRequest or wrap an instance of it in a utility class. You then add your own tag-like property to instances of your subclass or wrapper object.