iPadOS - File Sharing

Hi guys,

I’m currently porting my plugin to iPadOS. Everything that is audio-related seems fine, zero problems. Now I’m trying to add file sharing and management. A step back: the desktop version (standalone and AU/VST3/AAX) relies on a folder placed in “Documents”, where the user can save IRs, presets, his/her license file etc… this is the structure:

Some factory files are checked at startup and if they are not up to date (or they’re not there) they are created/updated by the plugin itself (thanks to a copy in its BinaryData).
For the iOS build this is the list of CMake flags that I’ve added, according to the JUCE CMake user guide:

juce_add_plugin(${PLUGIN_NAME}
    VERSION ${VERSION_NUMBER}                                
    ICON_BIG Assets/icon_p.png                             
    ICON_SMALL Assets/icon_p.png 
    COMPANY_NAME XXXXXX                           
    IS_SYNTH FALSE                              
    NEEDS_MIDI_INPUT TRUE               
    # NEEDS_MIDI_OUTPUT TRUE/FALSE              
    IS_MIDI_EFFECT FALSE                        
    # EDITOR_WANTS_KEYBOARD_FOCUS TRUE/FALSE  
    AAX_CATEGORY AAX_ePlugInCategory_Harmonic
    VST3_CATEGORIES Distortion
    HARDENED_RUNTIME_ENABLED TRUE
    HARDENED_RUNTIME_OPTIONS com.apple.security.device.audio-input 
    MICROPHONE_PERMISSION_ENABLED TRUE  
    BLUETOOTH_PERMISSION_ENABLED  TRUE  
    FILE_SHARING_ENABLED TRUE
    DOCUMENT_BROWSER_ENABLED TRUE
    REQUIRES_FULL_SCREEN TRUE
    BACKGROUND_AUDIO_ENABLED TRUE
    APP_GROUPS_ENABLED TRUE
    APP_GROUP_IDS ${XXXXXXXXXXX}
    IPAD_SCREEN_ORIENTATIONS UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight
    TARGETED_DEVICE_FAMILY "2"
    COPY_PLUGIN_AFTER_BUILD FALSE               
    PLUGIN_MANUFACTURER_CODE Xxxxxx              
    PLUGIN_CODE Xxxxxx                            
    FORMATS AU AUv3 VST3 AAX Standalone                     
    PRODUCT_NAME "XXXXXXX")                         

(I’ve placed some “x” over some private names). After that I create the plugin folder not in “Documents” like I do in the desktop version, but here:

File pluginFolder  { File::getContainerForSecurityApplicationGroupIdentifier(XXXXXXXX).getChildFile(XXXXXX) };

Everything works apparently, when I open the standalone app on my iPad the factory presets and IRs are visible in the UI, I can select them and so on. Now the problem is: how can I access this folder from outside the app? If I connect my iPad to my MacBook, I can see this:

But as you can see it’s empty! Am I using the right folder (getContainerForSecurityApplicationGroupIdentifier)? How can I make my app files visible on macOS? I would like to give my users the possibility to copy to their iPad their presets and IRs made on the desktop version.

Thank you!

Did you set UIFileSharingEnabled = YES in your Project .plist? This entitlement (otherwise known by the property “Application supports iTunes file sharing”) is definitely needed if you want users to access your Apps sandboxed Documents/ directory … (EDIT: note, adding the flag in CMakeLists.txt is one thing - verifying it manually exists in your .plist is another thing … if these two data differ, then there’s something unexpected going on in your build process…)

I have these:

if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
    # iOS Only
    set(IOS_SETTINGS
        IPAD_SCREEN_ORIENTATIONS UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight
        FILE_SHARING_ENABLED TRUE
        DOCUMENT_BROWSER_ENABLED TRUE
        SHOULD_ADD_STORYBOARD TRUE
        CUSTOM_XCASSETS_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/assets/ios/Images.xcassets"
        APP_GROUPS_ENABLED TRUE
        ICLOUD_PERMISSIONS_ENABLED TRUE
        STATUS_BAR_HIDDEN TRUE
        BACKGROUND_AUDIO_ENABLED TRUE
        BACKGROUND_BLE_ENABLED TRUE
        TARGETED_DEVICE_FAMILY "2"
        REQUIRES_FULL_SCREEN TRUE
        APP_GROUP_IDS "group.com.xxx.yyy"
        NEEDS_STORE_KIT TRUE
    )
    add_definitions([[-DJUCE_CONTENT_SHARING=1]])
endif()

Thats fine - you’ve got a functioning CMake build harness. But the problem is that the entitlement to gain access to the apps private documents folder isn’t in place - so either the CMake harness is not publishing the entitlements into your project properly, or something else is wrong …

Incidentally, did you reload the CMake project? Try removing your build/ folder entirely and regenerating it …

Yes! I’ve checked that, and also I’ve done a complete clean and rebuild and checked again. I can see the folder on my Mac (see screenshot above) and also on my iPad in the “Files” app, but it’s empty. The app is actually creating files somewhere but not there, I’m using “getContainerForSecurityApplicationGroupIdentifier” is that the same folder?

The app I’m 100% sure that is creating some files, because I can see them inside its UI and also I can modify presets, restart the app, and my changes are still there, so where are those files?

(I’ve also debugged the app to check the paths but since I don’t know the path of the folder I see in Files, I don’t know if my files are actually there but hidden or they are somewhere else)

Thank you!