How to build an app that syncs when data is entered offline?
===

Let's say I build a todo app with an iphone app AND web app with some sort of centralized DB. If I add todos on my iphone without an internet connection, I will obviously not be able to see them on the web app. Since no API request can be made while offline, the data is not in the DB.

To prevent the tasks added while offline from getting lost, would you store them locally and then when an internet connection is established, then make the API calls to create these tasks and add them to the DB? 

How exactly can this be done in iOS? Do I just build the object locally? How can you make it so that it knows specific tasks are not in the DB and should make API calls to make them? 