iphone - Using different delegates for NSXmlParser -


I'm trying to figure out the best way to design something, I'm writing an iPhone app and for the most part I am using async calls for a web service. This means that I'm setting up a URLConnection camera, I start making calls and calls me back when the data is available or an exception occurs. It works well and I think that is the right way to handle things.

For example:

I request a list of people from a web service. As a result, there are XML person elements in the list, which will be translated into object-c "person" objects by my XmlDelegate

When I call the function to get the person, then I will say "Personal Deliigate" I am a protocol with a person called "person reakyavide: (person *) p". Therefore, every time I get a complete person object, then I call that method and all is well. Therefore, my expansion view (or search result view) just gets the element because they are available

The problem occurs when I need to get more specific object. In my specific case, I need to get the first and final appointment for the person. Therefore, I need to call two API calls to get these two single placement items. For each appointment object, the registered appointment result is available for delegate. The call will be made, but how will I know which is the first and who is the last? I have to handle the matter in any way when there are no "first" or "last" appointments and the reps will never call.

Would it be wise to design it correctly? Should I add some additional reference information for the initial request that the handle in the rep have been returned? The opaque piece of data that only understands the person making the initial call? What are my other options?

Solution

I'm actually ending up, just passing the opaque piece of data along with the appointment of the representative. Therefore, when I request an appointment object, I have a method:

  getNextAppointment withDelegate: Tag with self: Get "Next" Delegate with Refutation: Tag With Self : @ "Previous"  

In this way when the rep is called, I know what is being done for appointment.

"Appointment result call will be called due to each appointment object, but how do I know that the first And who is the last one? "

Looking at the order in which you receive these callbacks, or seeing some value in that XML data, I do not know your data like sequence or data.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -