Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to access user-provided audio file persistently in IOS
Forum Updated to NodeBB v4.3 + New Features

How to access user-provided audio file persistently in IOS

Scheduled Pinned Locked Moved Solved Mobile and Embedded
2 Posts 1 Posters 247 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MetalMajorM Offline
    MetalMajorM Offline
    MetalMajor
    wrote on last edited by
    #1

    Hello,

    I use Qt 6.4.1 to develop an IOS application with C++ and QML. I can open a sound file using the Qt file picker dialog and then I get the url to that sound file. For example, I get

    file:///private/var/mobile/Containers/Data/Application/4557D5E4-68BA-4341-9F4F-2A07D5E87B4D/tmp/runsomething.App-Inbox/myaudiofile.wav
    

    So I can at that moment load the audio file into the QAudioPlayer and it works and plays.

    I then store this URL in a json file to later retrieve it. And the problem is that this seems to be a sort of temporary file url, because upon restart of my application, that URL does not work anymore.

    So, my question is how to handle this? Do I need to copy it myself to my own dir that I can create for example under the "Library/Application Support" path?

    /var/mobile/Containers/Data/Application/4557D5E4-68BA-4341-9F4F-2A07D5E87B4D/Library/Application Support/App
    

    Or is there some other way? I saw this post which allows a user to share a file with your application and seems to copy it inside your apps' storage. Then probably it will not be a "tmp" file anymore and the link to that file will work even after application restarts. Is that how you should do it? I don't really like that approach and would like to avoid it if possible.

    I read about app sandbox capability, but I can't seem to add it to my IOS project using xcode, it does not show up in the list of capabilities. So I'm stuck there now and think that would be a way to enable access to files permanently without having to copy them.

    Thanks for any pointers or help!
    Best regards

    1 Reply Last reply
    0
    • MetalMajorM Offline
      MetalMajorM Offline
      MetalMajor
      wrote on last edited by
      #2

      I found the solution, so the answer is now on stack overflow: https://stackoverflow.com/a/76936616/1882056

      Best regards,

      1 Reply Last reply
      0
      • MetalMajorM MetalMajor has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved