We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Fad92
6 years agoExplorer | Level 3
Dropbox API Help
Hi guys, just some issues i'm having integrating dropbox into my iOS app. Basically i have it working kind of. I can upload a voice recording into text, into my dropbox folder via the API. The only i...
Greg-DB
Dropbox Community Moderator
6 years agoSo if I understand correctly, this code is producing multiple copies of files in Dropbox, when you only want it to make one.
Looking through the code, there are a few things to note:
- You seem to be calling 'authorizeFromController' every time 'recordCountdown' runs. The 'authorizeFromController' method initiates the app authorization flow, and you only really need to call that once per user. Generally, you'll want to call that when they tap on whatever button you put in your app specifically for the purpose of allowing them to connect their Dropbox account. You can find information on implementing that here. Once they authorize your app, it will receive an access token that the app can re-use without them going through that flow again. The SDK automatically stores that for you. You can re-use it via the authorizedClient as shown here.
- The Dropbox file upload is performed by the call to 'self.client.files.upload'. I see you're also calling this every time 'recordCountdown' runs, so the number of uploads you make will be determined by how many times 'recordCountdown' runs.
- Based on the output showing multiple lines of "This is the speech", it looks like 'handleTimer' is being run repeatedly, which itself triggers a call to 'recordCountdown' each time, which performs an upload each time.
So, it looks like this code is working as written. If you only want to perform one upload, you'll need to update your code to only call that method once. (It may also be helpful to use the debugger to step through the code to see what's happening.) The actual issue here isn't really a matter of the Dropbox API though, and is more a matter of how you structure your code, so I can't offer more help in that regard.
FrancisAdewale92
6 years agoNew member | Level 2
Thanks for your response.
I don't use a button to start the recording. The way my App works it automatically starts recording after 2 seconds and stops recording after 10 seconds. in which it takes that converted speech to string onto the dropbox. the main issue is, even if i say one word into the mic it will append onto the current string multiple times. e.g. if i say "ok" once it will print,
ok
ok
ok
everything i say after that will append onto the string after that
I think the issue is the NRSpeechToText framework that i imported. No matter what i try to do it will always upload multiple textdocuments. I may have to use Apple's speech framework instead for better funtionality.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!