A long time reader, first time here.
I am creating a test application that creates an NSURLConnection and then maps the result to a UILabel.
I am currently using the Center Notification Center observer, which calls a notification from connectionDidFinishLoading, to wait for the connection to complete before looking for the result.
However, what I'm trying to conceptualize is where to store the response data so that I can access it from my view controller and post the result to UILabel. (Or from anywhere other than an instance of my connection class, for that matter.)
I do not want to post directly to UILabel from connectionDidFinishLoading. I need a way to decide what I will do with the answer later, so my connection class remains generalized.
I need a better way to save the response data somewhere where I can reference it after the instance of the Connection class is complete.
Ideally, it should be somewhere that I can have multiple instances of the Connection open class and access each answer each time. This eliminates the possibility of simply creating a variable in my view manager or somewhere even more global and uploading the answer to it.
Any ideas on which design patterns can / should be used here will be greatly appreciated!
source
share