forum

Home / DeveloperSection / Forums / Multiple NSURLConnection delegates in Objective-C

Multiple NSURLConnection delegates in Objective-C

Tarun Kumar 1789 27-Aug-2015

I have two NSURLConnections. The second one depends on the content of the first, so handling the data received from the connection will be different for the two connections.

I'm just picking up Objective-C and I would like to know what the proper way to implement the delegates is.

NSURL *url=[NSURL URLWithString:feedURL];
NSURLRequest *urlR=[[[NSURLRequest alloc] initWithURL:url] autorelease];
NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:urlR delegate:self];

I don't want to use self as the delegate, how do I define two connections with different delegates?

NSURLConnection *c1 = [[NSURLConnection alloc] initWithRequest:url delegate:handle1];
NSURLConnection *c2 = [[NSURLConnection alloc] initWithRequest:url delegate:handle2];

How would do i create handle1 and handle2 as implementations? Or interfaces? I don't really get how you would do this.

Any help would be awesome.


Updated on 30-Aug-2015

Can you answer this question?


Answer

1 Answers

Liked By