My NSURLSessionDelegate methods are not getting called during a background download

后端 未结 2 1090
死守一世寂寞
死守一世寂寞 2020-12-30 10:13

I\'m trying to set up a download using NSURLSession that will continue in the background. I have a singleton class called DownloadManager which bu

2条回答
  •  清歌不尽
    2020-12-30 11:00

    I had a similar issue, the application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) in my AppDelegate never was called when the app was downloading content in the background.

    Turned out that I set the sharedContainerIdentifier in the URLSessionConfiguration. After I removed this line out of the URLSessionConfiguration it all started to work.

    sessionConfiguration.sharedContainerIdentifier = "my.shared.group"
    

提交回复
热议问题