1

What I'm looking for is a point in the right direction of helping me create a better concept of what I need to do within my application design.

What I'm trying to do is have a class that will make network requests, IE: getUser, getTimeline, getLocation. Once the data has been recieived via -(void)connectionDidFinishLoading: have JSON (for my application I'm using TouchJSON) to parse the the data and with that data return an array or object of it.

All the above I can do, however I find I need to do it in every class I create which leads to a lot of code, and redundant code at that.

Basically if I want to do this approach now this is a rough walkthrough of what happens:

So for example:

  1. [View 1]->NetworkActivity Object -> getUser
  2. [NetworkActivity] -> getUser -> makeConnection -> parseObject -> return object
  3. [View 1]->getUser method is now complete and is empty, which in turn now means I have nothing to show

Now I understand that because im using Asynchronous request this is why this is happening, however what I'm after is a way to accomplish this approach without having to create several classes that basically do the same thing. I'm not looking for "the answer" just a nudge or a point in the right direction of something I can read or try that would better help me understand this.

Also I'm sorry if this was at all confusing, I tried to describe it as best as I could, but please do understand - I'm kinda confused at it all myself!

1 Answer 1

2

Take a look at Matt Gemmell's MGTwitterEngine which is a great example of how to develop a client that targets a specific API, Twitter. If you know that the serve implements RESTful web services, then you can also take a look at the iPhone on Rails project which implements a generic controller. You provide the model and the controller takes care of the REST.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I'll look at both of these a little later today when I get some time. At quick glance this is what I'm looking for, just something I can look at for reference! It's hard finding complete examples on this subject.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.