I created a simple iOS test app that creates a file locally and uploads this to the associated dropbox share. My objective is to keep updating this file (overwriting it) based on certain events (button press). The contents of the file is simply the current date & time at the time of the event.
When I first run the app, the upload works every time - if the file existed before it is overwritten (updated) using this:
NSString * destination = @"/";
NSString * rev = [_fileDetailsDict objectForKey:[destination stringByAppendingString:fileName] ];
[[self restClient] uploadFile:fileName toPath:destination withParentRev:rev fromPath:fullPath];
Whereby _fileDetailsDict holds the parent rev, needed to overwrite the file and not create a copy.
The trouble is that if the application attempts to update the file a second time (based on me pressing a button), I always get a "conflicted copy" error response from dropbox. If instead, I restart my app, the update happens fine again. At first I thought this to be a timing problem but even if I wait several minutes to press the button this problem persists.
It "feels" as if I didn't close out the upload to dropbox somehow. What am I missing?