I'm using the Dropbox Swift SDK in my iOS app, and am currently trying to figure out what the proper response is for an error I've encountered.
My basic flow is that a PDF gets uploaded to the app's folder in Dropbox, and then a shared link is retrieved for that file. Below is my code for this:
let request = client!.files.upload(path: "/My.pdf", input: pdf)
.response { response, error in
if let response = response {
print(response)
} else if let error = error {
print(error)
}
}
.progress { progressData in
print(progressData)
}
client?.sharing.createSharedLinkWithSettings(path: "/Pinch.pdf").response { response, error in
if let link = response {
self.pinchDropboxLink = link.url
print(link)
} else {
print(error!)
}
}
This works as expected the first time. However, on the second time the code runs, I get this response...which occurs repeadelty, even after I've manually deleted the old file from the Dropbox folder:
API route error - {
".tag" = path;
reason = {
".tag" = conflict;
conflict = {
".tag" = file;
};
};
"upload_session_id" = "AAAAAAAAIWbPobc-HKe-gA";
}
API route error - {
".tag" = "shared_link_already_exists";
}What's the best way to resolve this / work around in this scenario?