Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I have been able to get the Dropbox SDK working for objective C. The problem I am running into is that when I upload my backup of a SQLite database it is no longer being recognized as a DB. After some searching it seems that the issue may be that upon upload the DB may be in use. Any assistance on how to ensure it is not in use before uploading or kill any processes that may be using it? Additionally I noticed that the code for uploading uses "uploadData" whereas the code for downloading uses "downloadURL" - could that have anyhting to do with it?
The example I linked to happens to use uploadData, but you can also pass a 'mode' to uploadUrl. Constructing and passing the mode works the same way for both.
UPDATE: good news is I was able to find some code that worked in uploading the file and the subsequent download and restore is now working.
New smaller issue:
I need to figure out the code to allow overwrite as if the backup already exists then it will fail on upload currently.
[[client.filesRoutes uploadUrl:@"/backups/Backup.sqlite" inputUrl:databasePath] setResponseBlock:^(DBFILESFileMetadata *metadata, DBFILESUploadError *uploadError, DBRequestError *error) { if (metadata) { NSLog(@"The upload completed successfully."); NSLog(@"File metadata:"); NSLog(@"%@", metadata); [self enableRestore]; } else if (uploadError) { NSLog(@"Something went wrong with the upload:"); NSLog(@"%@", uploadError); } else if (error) { NSLog(@"Something went wrong with the API call:"); NSLog(@"%@", error); } }];
I'm glad to hear you already sorted out the original issue.
To control overwriting, you should use this version of the uploadUrl method, which takes a 'mode' parameter. The 'mode' parameter accepts a DBFILESWriteMode object, which you can set to your desired write mode, such as "Overwrite". There's an example of that here.
Greg - thanks as always for the reply. This code is where I started from. Using that code (uploadData) the SQLite file was not retaining itself as a DB. Switching to the code I have now with uploadUrl is functioning as expected with the exception of the overwrite issue. I will chose the overwrite issue and possibly just code around it if there is no alternative.
The example I linked to happens to use uploadData, but you can also pass a 'mode' to uploadUrl. Constructing and passing the mode works the same way for both.
The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.
Sound good? Let's get started.Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on Twitter or Facebook.
For more info on available support options, see this article.
If you found the answer to your question, please 'like' the post to say thanks to the user!