URLSession data task block is not calling when the app is in background and it stuck at dataTask with request. When I open the app the block ge
URLSession
dataTask
You need a background session. The URLSessionDataTask which as per Apple's documentation doesn't support background downloads.
Create a URLSessionDownloadTask and use its delegate method it should work.
URLSessionDownloadTask
Follow this link