Possible Duplicate:
Managing two NSURLConnection
NSURLConnection delegate
I have two different methods who calls different NSURLConnections;
Method A
NSURLConnection *serverConnection = [[NSURLConnection alloc]initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:addressOfSideWebService]] delegate:self];
Method B
NSURLConnection *serverConnection = [[NSURLConnection alloc]initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:addressOfMainWebService]] delegate:self];
The problem is, both of these NSURLConnections triggers same delegates;
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[self.serverData appendData:data];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *response = [[NSString alloc]initWithData:self.serverData encoding:NSUTF8StringEncoding];
// use data
}
What I want to know that, can we tag NSURLConnections' or method called NSURLConnection, in order the identify which function or method so I can act upon it.
Can we set different delegates, or is there any other methodology that I should be following?
I hope I was clear, any other information can be supplied. Thanks.