Forum Discussion

H. Yi-Shan's avatar
H. Yi-Shan
New member | Level 1
11 years ago

Getting deleted DBRecord information from Datastore sync:

I'm developing an iOS app with Datastore.

How do I know records deleted from remote? I watch changes with observer (status.incoming) and call sync: and it return the changes. The deleted DBRecord will be return but the properties can't be accessed, which I use for storing a unique ID for my data, and compare them in my Core Data database.

(I don't use Datastore as my main database is because I also have an iCloud sync option. )

The only thing I can get from the deleted Record is isDeleted flag. There seems not much I can get with the sync: API. Right now I just have to make my own isDeleted flag in the DBRecord but not actually delete the record.

Is there better way to do it?

Thanks.

4 Replies

Replies have been turned off for this discussion
  • There's no way from the iOS Datastore SDK to access the fields of deleted records after they've been deleted.

    Why don't you just use the record ID as the unique ID? That seems like a more robust solution in general. (For example, you get the guarantee that you won't have two records with the same record ID.)

  • H. Yi-Shan's avatar
    H. Yi-Shan
    New member | Level 1
    11 years ago

    Thanks for the clarification.

    I don't use record ID as unique ID because I have other sync options (iCloud).

  • I don't understand. Instead of putting the ID in another field, just make it the record ID.

    E.g. instead of this:

    [myTable insert:@{ @"unique_id": @"abc123", @"foo": @"bar" }];

    you can do this:

    [myTable getOrInsertRecord:@"abc123", fields: @{ @"foo": @"bar" }, ...]

  • H. Yi-Shan's avatar
    H. Yi-Shan
    New member | Level 1
    11 years ago

    Thank you. Now the problem solved.

    I think I just missed this paragraph in tutorial:

    "Each record has a string ID. An ID can be provided when a record is created, or one will be automatically generated and assigned if none is provided. Once a record is created, the ID cannot be changed."

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!