Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Robert S.138
10 years agoHelpful | Level 7
Threads, tasks, and the Objective-C SDK
Having completed an Android version of my app, I was hoping that the Objective-C version for iOS would be similar. But looking at the DBRoulette example, there seems to be a big difference regarding...
Robert S.138
10 years agoHelpful | Level 7
OK, I figured out how to make the API calls blocking. Here is my worker thread function, processWithRecursion (in pseudo-code):
processWithRecursion( currentDirectory )
{
set waiting = YES; //..a volatile, atomic variable
call listFolder: currentDirectory, with completion block:
{
get list of entries;
set waiting = NO;
}
do forever
{
sleep 80 milliseconds
if( not waiting ) break;
if( threadMustStop ) return; //..set by "Cancel" button
}
for each element in that list, do:
{
if(element is a directory)
{
create local destination directory of that name
processWithRecursion(currentDirectory + subdirectory name);
}
else //..element is a file
{
set waiting = YES;
call downloadData: elementPathName, with completion block
{
get the data downloaded and write to local file
set waiting = NO;
}
do forever
{
sleep 80 milliseconds
if( not waiting ) break;
if( threadMustStop ) return;
}
}
}
}
Is this an advisable way to the SDK to download an entire directory?
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!