How to avoid “conflicted copy” when uploading to dropbox from iOS client

回眸只為那壹抹淺笑 提交于 2019-12-23 13:34:15

问题


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?


回答1:


Try passing nil to the withParentRev parameter. I guess you know the usage of the files .rev parameter, I tried passing nil to the parameter and it created a new file every time (not a copy).

May be this would be much help for you. I referred this when I had a similar problem.



来源:https://stackoverflow.com/questions/16253849/how-to-avoid-conflicted-copy-when-uploading-to-dropbox-from-ios-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!