I am using dropbox to upload and download shared files from the dropbox account. this means that every user is able to download the latest version of the file, modify it, and re-upload it, substituting the one before. If there is a stable internet connection, this process works, but if the internet is not responding, the file will be corrupted, and a version of the file that is not complete will be uploaded. This will damage all the users. Is there a way to check if there is a stable internet connection with the dropbox servers? I tried reachability, but it only controls internet connection, not dropbox servers responding.
The code for the error:
- (void)restClient:(DBRestClient*)client uploadFileFailedWithError:(NSError*)error {
NSLog(@"File upload failed with error - %@", error);
UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"Offline mode" message:@"Your event is going to be posted when you create a new event." delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles: nil];
[alert1 show];
}
The point is that even if this function is called, the file is still uploaded on the internet!
Thanks for any help.
To check if your account is linked with dropbox use this .
[[DBSession sharedSession] isLinked]that returns aBOOLvalueand then to restore your file to previous version ..
For that you just have to understand them clearly
for that you can use either one of these method
Obtains metadata for the previous revisions of a file.
Only revisions up to thirty days old are available.
for example :
[[self restClient] loadRevisionsForFile:@”YourFile” limit:10];
and these delegate methods from where you can get the array of revisions values for your file
for example:
So now you have array of metadata of previous revisions of your file.
Case 1: Restore the file in Dropbox
// Restores a file at path as it existed at the given rev and returns the metadata of the restored file after restoration
// and their delegate methods
for example:
then Load the file to your database path..
that’s it ,.
Case 2: Restore file only in App’s Database (Not in Dropbox)
/* This will load a file as it existed at a given rev */
for example:
[[self restClient] loadFile:@"yourFile" atRev:revStr intoPath:toYourDatabasePath];