swift - how to handle a long wait time for data, when ios 8+ app has been backgrounded by user -


i've spent lot of time looking @ options still not 100% clear, wanted reach out guidance.

scenario this:

  • user submits https request our backend server data via ios app

  • depending on data, first (only) request can take long time. like, say, 10+ minutes (shocking know)

  • when payload become available , returned via https request, want use update ui in background.

the assumption here user has moved on app whilst waiting data arrive (and lets assume haven't killed app).

is possible handle via ios 8+ api's without app being force/killed apple when in background ?

could use background task example?

var backgroundtask: uibackgroundtaskidentifier  xxx.beginbackgroundtaskwithname... 

etc

before testing code blocks wanted see if has (a) done and/or (b) whether we're heading in right direction

thanks help.

you should re-think on web service may take 10 min process. if not able optimize server task processing time below 1 of idea may you.

  • you can divided 1 request multiple request reduce processing time , response in faster way.

  • your server should sent notification app when done task. app came know task done.

i not sure why try update ui when apps in background mode , may try update ui when users come foreground mode background mode.

please check this link show example of long running task. use blank audio play keep alive app background task.


Comments