URLSessions give URLResponse nil when app goes to background

138 Views Asked by At

I use URLSessions to do my network calls and it always fails when I put my app to background state. When I bring the app to foreground state, the URLSession give URLResponse as nil.

How can I make it work in background state?

1

There are 1 best solutions below

0
slobodans On

You can get URLSession to work in background state if you configure session for background download or upload. But if you use session for regular backend API call, best that you can do is to repeat call after application enter foreground again.