Sound tracks assets

I'm writing an app that, among other things, need to be able to play several tracks using AvAudioEngine.

My question is about the best practice for carrying with the App a set of tracks.

I could 'bundle' them with the app but currently they are about 400MB and I think it's too much. I think that this would also significantly slow my deploy times every time I need to run/debug the app.

On my iPad Pro, using the File app, I can see the 'On My iPad' folder and inside that folder I already see some folders used by others App, like Cubasis LE, Acrobat and GarageBand for iOS.

I can't find any example that shows me how to access these locations and which capability I need to add to my app (if any).

Can you please point me in the right direction?

Thanks,

Guglielmo

Replies

Are these tracks a static set of assets which are the same for all users? Perhaps you could use on-demand resources: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/index.html

If you want to access existing files in On My iPad, use UIDocumentPickerViewController to allow the user to select files that your app can access: (https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller)

  • Thanks for your answer Clenart. The tracks are a static set of assets. For now I'm only interested in developing the app for myself so I decided to download these assets from an http server I wrote on the fly and store them in the documentDirectory folder. I'm still curious about how to obtain an URL of the 'On My iPad' folder without having to use the UIDocumentPickerViewController (the app don't need to ask for the user to browse through folders).

  • Check out this documentation for LSSupportsOpeningDocumentsInPlace: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW13

    In iOS 11 and later, if both this key and the UIFileSharingEnabled key are YES, the local file provider grants access to all the documents in the app’s Documents directory. These documents appear in the Files app, and in a document browser. Users can open and edit these document in place.

Add a Comment