views:

36

answers:

1

I have an iPad app that works both on and offline but when I am offline there are web service calls that will need to be made once online availability is an option again.

Example: A new client is added to the app, this needs to be sent to the web service but since we are offline we dont want to slow the user down so we let them add locally and keep going but we need to remember that that call needs to be made to the web service when we can. Same thing for placing orders and such.

Is there some sort of queue that can be setup that will fire once we have connectivity?

+1  A: 

I don't think the overhead of a heavyweight tool like MSMQ is needed for a simple action. You can use Core Data, persist managed objects with the data needed to call the web service, and only delete each managed object after a successful post. There might or might not be a way to capture an event when connectivity starts, but you can certainly create a repeating NSTimer when the first message is queued and stop it when there are no messages in the queue.

Peter DeWeese
the queue part is my question, looking for a little direction on how to accomplish that. not sure how to queue up function calls. I just used MSMQ as an example because I have used that in the past.
Slee
I just told you how to make a queue. :-) Use Core Data. Any ordered collection is effectively a queue. Fetch one, process it, delete it. You could even queue up function calls, but there is probably no need, as your processing thread can know which function to call based on the data it fetches.
Peter DeWeese
nothing like overlooking the obvious - thank you!
Slee