I have a nsurlconnection that i set the delegate as self. I have the four methods didrecieve, did finish, did fail, and the other one. My question is how to set it up so that i include what needs to be done after completion. This is needed because I have different nsurlconnection requests throughout the class, and have unique responses. Thanks.
Share
Your question is not clear. First of all, it doesn’t sound like you’re using
NSURLConnectionsynchronously, so your question title seems wrong. Then, if you want to do something when the connection completes, put it in the did-finish and did-fail methods.If you want to distinguish among multiple connections, use the parameter for the connection that’s passed in to the delegate methods. One thing you can do is have a dictionary whose keys are
[NSValue valueWithNonretainedObject:theConnection]. The value can be anything of use, including another dictionary.Or, you can use a separate object to manage and be the delegate for each connection. If there’s enough specific to each connection that you have to keep track of data about it, then maybe it warrants a separate object to manage things.