从今天扩展开始 NSURLSessionDownloadTask

starting NSURLSessionDownloadTask from today extension

我有一个主机应用程序,它有一个后台下载会话,可以完美运行,但是通过今天的扩展程序启动下载我得到这个错误:

The operation couldn’t be completed. (NSURLErrorDomain error -995.)

我该怎么办? 甚至有可能从今天开始下载扩展吗?

-995NSURLErrorBackgroundSessionRequiresSharedContainer。您必须设置 sharedContainerIdentifier of the NSURLSessionConfiguration. See App Extension Programming Guide: Performing Uploads and Downloads.