URL::downloadToFile should supply a `sharedContainerIdentifier` to iOS

Hi,

I have an iOS App / AUv3 plugin that downloads sample libraries using the URL::downloadToFile() function. It works really well when running the standalone app, but finishes with an error when I try to run the same function from within an AUv3 plugin. Has anyone else had this experience? I looked and the specific error that iOS is returning is “The operation couldn’t be completed. (NSURLErrorDomain error -995.)”

I tried finding out what this error means and I came across this response on StackOverflow: ios - starting NSURLSessionDownloadTask from today extension - Stack Overflow. As it happens, my App Extension does make use of AppGroups so that I can have a common storage area that is shared between my Standalone app and my App Extension). That StackOverflow response links to this Apple Page: App Extension Programming Guide: Handling Common Scenarios

That page says that in a case like mine – where one is using an AppExtension with an AppGroup – one needs to specify a sharedIdentifier for the NSURLSessionConfiguration. JUCE doesn’t allow one to do this. I would need to do something like this (juce_mac_Network.mm, line 448):

NSURLSessionConfiguration* config = config = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier: juceStringToNS (uniqueIdentifier)];
config.sharedContainerIdentifier = @"group.MyApp";
session =
            [NSURLSession sessionWithConfiguration: config
                                          delegate: delegate
                                     delegateQueue: nullptr];

I tried using this code above with my App Group identifier, and the download worked correctly…but there is no way to set this without modifying the JUCE code. I would love to have this added into the JUCE library somehow.

Has anyone else had these issues?