Hi,
My AUv3 plug-in can only load presets that were saved during the current session. Once the plug-in is restarted, the sandbox process within iOS blocks read access. I’ve gone through previous forum posts on presets and I believe I’ve incorporated all of those fixes. Does anyone have some insight?
File chooser code:
juce::File customPreset = juce::File::getContainerForSecurityApplicationGroupIdentifier("group.com.identifier");
loadChooser = std::make_unique<juce::FileChooser>("Load Preset", customPreset, "*.aupreset", true, false, this);
auto folderChooserFlags = juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectFiles;
loadChooser->launchAsync(folderChooserFlags, [this](const juce::FileChooser& fc) {
if (fc.getURLResults().size() > 0) {
auto file = fc.getURLResult();
// Read directly into memory
juce::MemoryBlock mb;
file.readEntireBinaryStream(mb);
// Assign state to plugin
audioProcessor.setStateInformation(mb.getData(), mb.getSize());
}
});
void CosmicGuitarAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
std::unique_ptr<juce::XmlElement> xmlState (getXmlFromBinary(data, sizeInBytes));
if (xmlState.get() != nullptr){
if (xmlState->hasTagName(tree.state.getType())) {
tree.replaceState(juce::ValueTree::fromXml(*xmlState));
}
}
}
Looking through the console during testing I see that iOS is denying read access to the shared group container:
Sandbox: CosmicGuitar(888) deny(1) file-read-metadata /private/var/mobile/Containers/Shared/AppGroup/6B863248-B4FD-4336-A770-8ABB61737381/File Provider Storage/Test22.aupreset
Sandbox: CosmicGuitar(888) deny(1) file-read-data /private/var/mobile/Containers/Shared/AppGroup/6B863248-B4FD-4336-A770-8ABB61737381/File Provider Storage/Test22.aupreset
This is on a 9th gen iPad running iOS 17.4.1
Thanks!