[SOLVED] How to create folder for save/get data in iOS by using widget code?
-
I already tried it and tried it now again. Does not work unfortunately.
The path it gave me (when I used qDebug() << file.fielname) was:
/var/mobile/Applications/262093E8-F9A7-4624-9559-FB3C6BF393E5/Library/Application Support/filename.txt
Maybe the problem is that there is a space between Application and Support? -
No, that should not be a problem. What error do you get from your file ?
-
Well, the interesting thing is that I get no error, I only see that the data has not been saved after I restarted the app. What path would I use with qrc? Because I also tried it with that => path ":/data/filename.txt", that is the path qt also tells I should take, but this works only if I run it on my mac. Do I have to include something in the .pro file?
-
Just to be sure I understand you correctly, do you want to read a file from qrc and store it on the device ?
-
yes, but I also like the other version if the data can be saved (sorry my english migth be unclear sometimes, I'm from switzerland)
-
No no, your english is not that bad, it was just to confirm I understood you correctly.
Since it's on iOS you may have to use the Q_INIT_RESOURCE macro to make your resources accessible.
-
Ok, I see it should work with that, but what line exactly do I have to add in main.cpp when I have Resources=>data.qrc=>/=>Database.txt or the "normal" path :/Database.txt? Because I tried many lines again and don't know where the error is.
-
IIRC:
Q_INIT_RESOURCE(data);
And then you can use the path like normal.
-
I don't know why, but it works now, I inserted the line in the main.cpp, but used the QStandardPaths::... Thank you very much!
-
qrc is a read-only system by design. Otherwise it would mean that you can rewrite your executable in place.
You're welcome !
By the way, no need to modify the title to mark the thread as solved, the "Topic Tool" button is there for that :)