Note that there are some explanatory texts on larger screens.

plurals
  1. POCore Data Sync - Tracking Deleted Objects
    primarykey
    data
    text
    <p>I'm setting up a basic sync service for an iPad application I'm developing. The goal is to have data consistent throughout several instances of the iPad app, as well as having a read-only version of the data on the web, hence rolling a custom solution.</p> <p>The current flow is this:</p> <ul> <li>Each entity has a 'created', 'modified' and 'UUID' field which are automatically updated by Core Data</li> <li>On sync, each entity with a created or modified date after the last sync date is serialised into JSON and sent to the server</li> <li>The server persists any changes to a MySQL database using the client-generated UUIDs as PKs (if there's a conflict, it just uses the most recently modified entity as the 'true' version, nothing fancy there) and sends back any updated entities to the client</li> <li>The client then merges these changes back into its Core Data DB</li> </ul> <p>This all seems to be working fine. My problem is how to track deleted objects using this method? I'm guessing I can add a 'deleted' flag to each entity and set this whenever a client deletes something, I can then push that change to the server with the rest of the sync data. Once the sync is complete then the client can actually delete these entities. My questions are:</p> <ul> <li>Can I override Core Data's delete methods to automatically set this flag?</li> <li>Will this require keeping all deleted entities indefinitely on the server? We'll have no way of knowing when every client has synced and actually deleted each entity (I'm not currently tracking client instances)</li> <li>Is there a better way of doing this?</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload