Post

Replies

Boosts

Views

Activity

Comment on Downloading many files in the background using NSURLSession
Thanks for the reply! "One? (-:" I'll see what I can do :) "Why are you’re using libcurl? My guess is that it’s adding a bunch of complexity without yielding much benefit" We use libcurl because the code is pretty much a cross-platform SDK of sorts, so it's not really an iOS app per se, more like an iOS (and other platform) SDK mostly made up of c++ code. "I don’t really understand your question, so let’s start with some factoids:" How I'm doing it is that I'll be stopping all curl downloads and resuming those ones that haven't been completed with NSURLSession in the background. Since we are downloading MB by MB (one MB for each chunk), any leftover downloads in-flight in libcurl (and not downloaded by NSURLSessionTask) will be restarted once the app goes back to the foreground when the user opens it. But yeah, your answer about large requests + the factoids clearly answered my question. Thanks! Another question that I want to ask, is there a limit to the number of concurrent http requests for NSURLSession? We want to maximize the bandwidth usage as much as possible when the app is in the foreground. Also, just to be clear, for downloads to be resumable, all the server needs are to fulfil these conditions stated in this page right? Are there any gotchas that I should take note of? I'll get back to my team on these limitations. Thank you so much! Also, sorry that the comments are just a slew of text cause I don't think markdown works here
Feb ’22
Comment on Downloading many files in the background using NSURLSession
Also, might I add, currently we are using libcurl to process our downloads. If we were to make server adjustments, we may just fully use NSURLSession to fulfil both foreground and background downloads (we would like to avoid this). Hence, I would like to ask: If we were to do this, are we supposed to create a NSURLSession with a background configuration right off the bat, and use that for both foreground downloads and background downloads? Or is there a way that we can still use curl in the foreground, and then startup a NSURLSessionDownload to be used in the background and resume the rest of the downloads there?
Feb ’22
Comment on Downloading many files in the background using NSURLSession
Hey eskimo, thank you for the input! Unfortunately, we require support for iOS 9 and above, therefore BackgroundTasks is not something we are able to do at the moment. Backend changes (decrease chunk count, archiving files before downloading etc) are possible but would be a last resort. Another solution that I had considered was to pre-create all the tasks before allowing the user to background the app, and then start around 5000 tasks all at once, with HTTPMaximumConnectionsPerHost = 5. Would this solution be viable? Is there some sort of cap on the number of queued-up tasks that nsurlsessiond can take?
Jan ’22