Search code examples
iosmobilesynchronizationdropboxdatastore

Cannot get data from my Dropbox Datastore using the Dropbox Datastore API


When I use the Dropbox Datastore API and link to another iOS device, I am not able to get the data in my datastore, but I can get the data in the datastore by using the first iOS device that I set up to use the Datastore API. What could be the problem here?

The code is of course the same that is being run on both devices.

DBAccount * account = [[DBAccountManager sharedManager] linkedAccount];
DBDatastore *dataStore = [DBDatastore openDefaultStoreForAccount:account error:nil];
DBTable *table = [dataStore getTable:@"crane"];

__pastCranes = [InspectionBussiness getRecords:nil DBAccount:account DBDatastore:dataStore DBTable:table];

Thanks for the help guys!


Solution

  • Hey so I figured it out. Somewhere after you link the Dropbox Account to this device you have to add this line. For me it was:

    [dataStore sync:nil];
    

    This updated the datastore on my device. Then I could load the cranes.

    It's strange though, because it doesn't work immediately. I had to run the app a few times before the updated information appeared in the table view.