Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reset all Sync data to get a clean whole store upload? #87

Open
shadow2000 opened this issue Oct 1, 2013 · 6 comments
Open

How to reset all Sync data to get a clean whole store upload? #87

shadow2000 opened this issue Oct 1, 2013 · 6 comments

Comments

@shadow2000
Copy link

I'm experiencing a few problems after updating my CoreData model (Issue #86). Even if I delete the remote dropbox folder and remove the app from all device but the one with latest data and doing a "upload whole store", new device doesn't get this latest data.

Maybe its related to some change sets on the device which is uploading the latest data, so I'm wondering if it is possible the erase all remaining sync sets? After that the whole store upload should contain the content of the sqlite store?

@MrRooni What do you say?

@shadow2000
Copy link
Author

I'm asking to get a workaround for my users.

@MrRooni
Copy link
Contributor

MrRooni commented Oct 3, 2013

If you remove all the data from Dropbox you should be getting errors returned through the ApplicationSyncManagerDelegate and DocumentSyncManagerDelegate methods. Specifically, once your know that syncing has been set up, if you get a callback from:

- (void)applicationSyncManagerDidPauseRegistrationToAskWhetherToUseEncryptionForFirstTimeRegistration:(TICDSApplicationSyncManager *)applicationSyncManager

then you know that something has gone sideways on Dropbox.

Similarly you can handle remote file structure changes through these DocumentSyncManagerDelegate methods:

- (void)documentSyncManager:(TICDSDocumentSyncManager *)documentSyncManager didPauseRegistrationAsRemoteFileStructureDoesNotExistForDocumentWithIdentifier:(NSString *)anIdentifier description:(NSString *)aDescription userInfo:(NSDictionary *)userInfo;

- (void)documentSyncManager:(TICDSDocumentSyncManager *)documentSyncManager didPauseRegistrationAsRemoteFileStructureWasDeletedForDocumentWithIdentifier:(NSString *)anIdentifier description:(NSString *)aDescription userInfo:(NSDictionary *)userInfo;

- (void)documentSyncManager:(TICDSDocumentSyncManager *)documentSyncManager didFailToSynchronizeWithError:(NSError *)error;

For that last one just check if the error code is TICDSErrorCodeSynchronizationFailedBecauseIntegrityKeysDoNotMatch or TICDSErrorCodeSynchronizationFailedBecauseIntegrityKeyDirectoryIsMissing

Hope this helps!

@shadow2000
Copy link
Author

Hi,

I will check the callback methods you mentioned this evening to get a better feeling what's going wrong.
But I do not know how I should do the reset of the sync setup as you suggested in #86

If you know that you've got the same data model on all your devices you should be able to reset your sync setup from one device and have all the other devices fall in line.

May you want to check the logs?
http://time2feed.larsmeynberg.de/ressources/Device1FirstStartAfterDropBoxDeleted.txt
http://time2feed.larsmeynberg.de/ressources/Device2FirstStartAfterUploadDevice1.txt

@MrRooni
Copy link
Contributor

MrRooni commented Oct 14, 2013

Assuming that your apps are properly handling the delegate methods I mentioned above, if you remove all the sync data from Dropbox and then push up a fresh baseline from one client, all your other clients should detect that the sync setup has changed and give the user appropriate options.

For instance, in MoneyWell, if we detect that the sync data on Dropbox has changed we let the user know and prompt them to setup syncing again. As they go through that process the sync setup classes that we've written handle allowing them to upload their document or download one that another user has posted.

@shadow2000
Copy link
Author

Ok if I delete the sync data from Dropbox will my App detect that via the
mentioned delegate methods. But my problem is that even if the other devices
are doing a download of the whole store they do not get the latest data. Do
I have to call a cleanup method first? Maybe on the first uploading device before the upload gets started?

It even fails if I uninstall all copies of my App but from one device and delete the App-Folder on Dropbox.
After deleting the Dropbox data the device detects that it have to upload
the whole store but when I download this store on a fresh new device it is
still some sync data missing.

@MrRooni
Copy link
Contributor

MrRooni commented Oct 19, 2013

It's possible that you're getting caught by some leftover files from a previous sync. You can stand up a temporary DocumentSyncManager to clean out the local files as well:

- (void)teardownLocalSetup
{
    NSError *fileCleanupError = nil;
    TICDSDocumentSyncManager *documentSyncManager = [[TICDSDocumentSyncManager alloc] init];
    [documentSyncManager removeLocalHelperFiles:&fileCleanupError];
    if (fileCleanupError != nil) {
        NSLog(@"%s %@", __PRETTY_FUNCTION__, fileCleanupError);
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants