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. [SOLVED] How to create folder for save/get data in iOS by using widget code?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to create folder for save/get data in iOS by using widget code?

Scheduled Pinned Locked Moved Mobile and Embedded
iosipadwidgetqt5.4
14 Posts 3 Posters 7.9k Views 2 Watching
  • 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 26 Jan 2016, 21:31 last edited by
    #4

    Hi,

    Aren't you missing a separator ? i.e. QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/filename.txt"

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Marco Polo
      wrote on 27 Jan 2016, 07:14 last edited by Marco Polo
      #5

      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?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 27 Jan 2016, 21:47 last edited by
        #6

        No, that should not be a problem. What error do you get from your file ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Marco Polo
          wrote on 27 Jan 2016, 22:10 last edited by Marco Polo
          #7

          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?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 27 Jan 2016, 22:19 last edited by
            #8

            Just to be sure I understand you correctly, do you want to read a file from qrc and store it on the device ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Marco Polo
              wrote on 27 Jan 2016, 22:30 last edited by Marco Polo
              #9

              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)

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 27 Jan 2016, 22:34 last edited by
                #10

                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.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Marco Polo
                  wrote on 28 Jan 2016, 05:49 last edited by Marco Polo
                  #11

                  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.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 28 Jan 2016, 08:26 last edited by
                    #12

                    IIRC:

                    Q_INIT_RESOURCE(data);
                    

                    And then you can use the path like normal.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Marco Polo
                      wrote on 28 Jan 2016, 08:58 last edited by Marco Polo
                      #13

                      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!

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 28 Jan 2016, 09:56 last edited by
                        #14

                        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 :)

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        13/14

                        28 Jan 2016, 08:58

                        • Login

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