How to download and read files on iOS (AUv3)?

Hi,

Can you please help me work out an example where a file is successfully downloaded and read on iOS? - specifically as an AUv3 plugin?

In the URL::DownloadTaskOptions Class Reference, I see there is the option withSharedContainer, documented as specifying “the container where the downloaded file will be stored”. How is that container specified? Is it the value set for the “App Group ID” attribute in the Projucer Xcode (iOS) exporter?

That field is disabled in my project’s Projucer UI. How would that field be enabled?

See this thread for more information about app groups:

You need to enable the App Groups Capability setting. I’ll add a note to the tooltip.

Thanks @t0m,

juce::File::getContainerForSecurityApplicationGroupIdentifier gives a path to the shared container.

With the “App Groups Capability” set to Enabled and the “App Group ID” attribute populated in the Projucer Xcode (iOS) exporter, I’m now able to download from an AUv3 plugin running within a host application on iOS with something like:

juce::File downloadDestination = juce::File::getContainerForSecurityApplicationGroupIdentifier(APP_GROUP_ID);
juce::File exampleFile = downloadDestination.getChildFile("example.ext");

auto dnlOpts = juce::URL::DownloadTaskOptions()
    .withSharedContainer(APP_GROUP_ID)
    .withListener(this);

juce::URL download("https://example.org/example.ext");

downloadTask = download.downloadToFile(exampleFile, dnlOpts);

Is the App Group an arbitrary string or number that one can invent or is it yet another Apple burocracy headache thing?