Search code examples
iosobjective-ctoday-extension

starting NSURLSessionDownloadTask from today extension


I have a host app that has a background download session which works perfectly but initiating the download through the today extension I get this error:

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

What do I do about it? Is there even the possibility to start download from today extension?


Solution

  • The -995 is NSURLErrorBackgroundSessionRequiresSharedContainer. You have to set sharedContainerIdentifier of the NSURLSessionConfiguration. See App Extension Programming Guide: Performing Uploads and Downloads.