views:

21

answers:

0

I'm writing a class that uses a JSON API for a website I visit. In my class I use NSURLRequest to fetch the data, but then I need to give the data to the app delegate. I realize NSURLRequest is asynchronous so I can't directly return the data.

So let's say in my class, the delegate calls getUserProfile, the method uses NSURLRequest to get the data (which is got in connectionDidFinishLoading), now how do I pass it back to wherever called getUserProfile?

I'm still a little new to the language so delegates and the like still slightly confuse me, I thought it may be possible to set a method in AppDelegate (such as displayUserProfile) then set that as a call back method - but I'm unsure of how this would be possible.

Sorry if I've not been clear, any help welcome, thanks!