I'm just starting out learning OBJ-C but I do have an end-goal app that I'm working toward building; this app will be a master/detail app on the iPad that will be required to keep itself updated with a webservice in "real time". It will also need to send data to the remote MySQL DB when one of the multiple users (on separate iPad's) performs certain actions within the app.
EDIT: As lxt has so helpfully clarified: ""Is it appropriate to use push notifications as a cue to poll a webservice" - the answer is sort of."
The example I've imagined for the purposes of this question is a Widget Inventory Manager that has "incoming" inventory that flows into the table view and "inventory storage bins" that the users will drag-and-drop inventory to in the detail view.
Like so:
NOTE: My application DOES NOT require itself to stay updated when not in the foreground. It can happily sleep away until its launched again; at which point it would need to update itself with the most recent data. Kyle has provided an answer for this specific aspect of the problem using applicationWillEnterForeground:
In order to accomplish this without overtaxing my webservice server I've imagined a solution that combines webservice polling and PUSH notifications to trigger the polls when one user (iPad) makes any changes to the data. So, the flow would be like so:
A "default" poll of the webservice would fire every minute regardless of any actions a user may perform.
When a user drags an inventory item from the tableview and drops it in a storage bin that would initiate a PUSH notification to any other iPad logged in to the same overarching account and trigger a webservice poll to refresh its data.
In short: Any time a user on iPad "A" changes anything a PUSH notification is sent to iPad "B", iPad "C", etc. When the PUSH is received by B,C,D, etc. they then poll the server to refresh their data.
The alternative to this is to have every iPad on the account firing webservice polls every 15secs; which seems bandwidth-expensive to me (and would often result in no changes to the data).
My question is less of a "How do I ...?" and more of a "How should I ...?". I realise StackOverflow may find this somewhat "subjective", but I think this is a very worthy question considering I've spent two days researching this specific practice (using PUSH notifications to trigger webservice polling) and found exactly zero relevent articles.
Thanks for taking the time to read this. Any help would be appreciated. Example code and/or specific framework/kit information would be greatly appreciated. But really right now I just need to know if this is a good idea or not.