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

**URL:** <https://forum.juce.com/t/how-to-download-and-read-files-on-ios-auv3/50755>\
**Category:** MacOSX and iOS\
**Created:** [March 27, 2022, 6:50pm UTC](https://forum.juce.com/t/how-to-download-and-read-files-on-ios-auv3/50755 "2022-03-27T18:50:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bthj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bthj/32/13060_2.png) [@bthj](https://forum.juce.com/u/bthj)\
**Post date:** [March 27, 2022, 6:50pm UTC](https://forum.juce.com/t/how-to-download-and-read-files-on-ios-auv3/50755/1 "2022-03-27T18:50:07Z")

</div>

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](https://docs.juce.com/master/classURL_1_1DownloadTaskOptions.html), I see there is the option [withSharedContainer](https://docs.juce.com/master/classURL_1_1DownloadTaskOptions.html#ab1a2051b037e1701915b51c4d8f1e146), 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?

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [March 29, 2022, 7:48am UTC](https://forum.juce.com/t/how-to-download-and-read-files-on-ios-auv3/50755/2 "2022-03-29T07:48:56Z")

</div>

See this thread for more information about app groups:

> [@App Group Folder Access](https://forum.juce.com/t/app-group-folder-access/23102/62):
>
> Coming to this thread trying to figure out what’s the best path for me to share a folder with JUCE AUv3 and Standalone it seems that you need: App Group ID (support by projucer/juce) getAppGroupContainerLocation - not supported by JUCE. Once I get the container location I can use it in both. is that correct? Maybe worth adding the getAppGroupContainerLocation into JUCE with AUv3/Standalone pretty common combo.

> [@bthj](#):
>
> That field is disabled in my project’s Projucer UI. How would that field be enabled?

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

---

<div class="post-metadata">

**Author:** ![bthj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bthj/32/13060_2.png) [@bthj](https://forum.juce.com/u/bthj)\
**Post date:** [March 29, 2022, 11:19am UTC](https://forum.juce.com/t/how-to-download-and-read-files-on-ios-auv3/50755/3 "2022-03-29T11:19:08Z")

</div>

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:

```auto
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);

```

---

<div class="post-metadata">

**Author:** ![ZioGuido](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/zioguido/32/6975_2.png) [@ZioGuido](https://forum.juce.com/u/ZioGuido)\
**Post date:** [May 3, 2022, 4:18pm UTC](https://forum.juce.com/t/how-to-download-and-read-files-on-ios-auv3/50755/4 "2022-05-03T16:18:24Z")

</div>

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