Avoiding a “conflicting copy” when uploading to Dropbox from an iOS client

I created a simple test application for iOS that creates a file locally and uploads it to the corresponding Dropbox resource. My goal is to update this file (overwrite it) based on certain events (click the button). The contents of the file are simply the current date and time during the event.

When I first run the application, the download is performed every time - if the file existed before it was overwritten (updated), using this:

NSString * destination = @"/"; NSString * rev = [_fileDetailsDict objectForKey:[destination stringByAppendingString:fileName] ]; [[self restClient] uploadFile:fileName toPath:destination withParentRev:rev fromPath:fullPath]; 

As a result, _fileDetailsDict contains the parent rev needed to overwrite the file, not create a copy.

The problem is that if the application tries to update the file a second time (based on the click of a button), I always get a “conflicting copy” response from dropbox. If I restart the application instead, the update will be fine again. At first I thought it was a synchronization problem, but even if I wait a few minutes to press a button, this problem persists.

It "feels" as if I somehow did not close the download to Dropbox. What am I missing?

+4
source share
1 answer

Try passing nil to the withParentRev parameter. I assume that you know the use of the .rev parameter. I tried passing nil to the parameter and each time I created a new file (not a copy).

Maybe this will help you. I called it when I had a similar problem.

0
source

All Articles