ios - How to manage many (>500) background URLSession downloads with AFNetworking 2.x? -


i have app on app store uses afnetworking 2.x download large files in background nsurlsession-based downloads, because user put app in background (it gets terminated after while of course, downloads finish same. wonderful). app working well. users downloading few files @ time.

now need make similar app, time instead of few large files, user want download large number of smallish files: example, 500 files 1-5mb each. again, app put in background, want stay nsurlsessiondownloadtask unless there's reason not to.

my question is, can create 500 nsurlsessiondownloadtasks @ once? afnetworking clever throttling not overload system? or ios it? or nothing it, , have painfully track & organize state of transfers across restarts of app (ie. because gets put in background terminated) ?

if knows limits of how many nsurlsessiondownloadtasks can create reliably simultaneously, awesome... thanks!

p.s. prefer obj-c swift, thx :)

last checked (haven't looked @ ios 9 betas), task creation unexpectedly expensive , superlinear. on test runs:

  • 50 tasks -> ~1.5s
  • 200 tasks -> ~11.5s
  • 500 tasks -> ~55s

since file count 5-digit number, scheduling @ once wasn't solution me. approach (which isn't in production yet, stopped working on feature in favour of other things), combines persistence nsurlsessiondownloadtask , uses session identifiers sort out logical download particular file belongs to. further downloads scheduled 1 of delegates depending on whether i'm on normal lifecycle or coming -application:handleeventsforbackgroundurlsession:completionhandler: (debugging situation can painful; nsuserdefaults friend). theory seems sound, can see tasks scheduled, i'm stuck getting ios downloader daemon conform will.

if server-side zip suggested benjamin jimenez option you, favour , use instead.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -