We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
VyacheslavBakinskiy
5 years agoHelpful | Level 6
Downloading in the background in iOS (Swift)
Hello, I'm using file download from Dropbox in my app. It works fine when app is active, but if my app goes into the background the download stops. How can I solve it? I use this code to download: ...
- 5 years ago
Hello, Greg!
I have new information regarding my question. On what do you run the code on a real device or on the Xcode simulator? I've always tested on a real device and was getting this issue. I decided to test it on the simulator and was very surprised that the download works fine on it. I also noticed that when I run the code on a real device - I get this issue, but if I then click to download another file, then I'll see that the first file is immediately downloaded, as if it had already been downloaded, but the completion handler didn't work.
What could be the issue? Why does it work fine on the simulator?
P.S. This issue happens only in case when device connected to the PC (Xcode), when I run app without connection to the PC the download works fine.
Greg-DB
5 years agoDropbox Staff
Thanks for the report. First, can you let me know the version number of the SwiftyDropbox SDK you're using?
Also, when you say "the download stops", do you get any error or output? And, do you get any result when you return to the app?
- VyacheslavBakinskiy5 years agoHelpful | Level 6
I use 6.0.3 version of SwiftyDropbox. No, I don't get any error. When I return to the app I see that download isn't complete. If you look at my code you'll see that I have completion handler which works when dowload is complete, and after return to the app I see that it didn't work.
Also in the downloadFile func I get download progress (I didn't include it in the question so as not to complicate)
.progress { progressData in
let progress = Double(progressData.fractionCompleted)
completion(progress)
print(progress)
}
When I start downloading a file and then minimize the application, then I'll see that progress stops and it doesn't start again if I return to the app
- Greg-DB5 years agoDropbox Staff
Thanks for the additional information. I just tried reproducing this with the code you provided. While I also see the progress reporting stop when the app is sent to the background, if I then bring it back to the foreground the download does then resume and complete.
Can you let me know how long you're leaving the app in the background before resuming it? Also, what version(s) of iOS are you seeing this with?
- VyacheslavBakinskiy5 years agoHelpful | Level 6
I leave the application in the background for a few seconds. I also tried leaving it on for a few minutes. The result is the same. I'm using iOS 14.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf 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 or Facebook.
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!