[SOLVED] Writing local file on iOS device



  • I am trying to write a local file from my iOS app created with Qt 5.4. After initial research it seems I need to write the file to the local Documents folder within my app bundle, but all of my attempts thus far have failed. I dumped the current path from a QDir object. It seems to stop at the app:

    "/private/var/mobile/Containers/Bundle/Application/72CF36AB-D88B-4877-8BCF-F73D49284CEE/tap_new_display_app.app"

    What is the best way to do this within Qt framework?

    Thanks!



  • hi,
    what worked for me :
    new QFile(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + "/" + name);
    best,
    patrik


  • Lifetime Qt Champion

    Hi,

    QStandardPaths with QStandardPaths::DocumentsLocation looks like what you want.

    Just beware of the automatic backup of the documents, depending on why you will be using it, disabling the backup might be a good idea



  • Thank you, that worked perfectly!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.