Hello all.
I am attempting to use ASIHttpRequest with the iPhone to get some information from a query-string based API on my site.
Currently, I am in the planning stages of my design and I am kind of stuck on how I should proceed.
I would like to have a class, that will handle all of the requests I will need. I plan on having different sections of the iPhone application call this class and within the class, I would like to run the ASIHttpRequest code. For example:
- I will pop up a modal view that will login.
- This modal view will call a function with the user/pass to the API class which will then put together the URL and call it.
- Once the URL request has been processed and finished, it will go into the requestFinished method or whichever I choose as the selector.
- The modal view will get back the responseString and proceed as desired.
This is where I am stuck. I would like to somehow pass the responseString back to the original caller of the network url request.
Should I use a delegate method? If so, how can I call that from within the requestFinished method? I thought about this, but I am a little confused as to how I would have the requestFinished function call that delegate. I might be missing a simple way to pass that delegate as an object along with an ASIHttpRequest.
I also thought about NSNotificationCenter, but I feel that would be more work than using a delegate.
I appreciate any help given.