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. iOS file access permission
Forum Updated to NodeBB v4.3 + New Features

iOS file access permission

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
11 Posts 3 Posters 4.7k 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 5 Mar 2021, 19:37 last edited by
    #2

    Hi,

    IIRC, you may have to add an entitlement to your app. See here.

    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
    • K Offline
      K Offline
      kgregory
      wrote on 6 Mar 2021, 19:13 last edited by
      #3

      hmm, I added that to my info.plist and it didn't help.

      I'm not sure how the iOS filesystem works. I don't see a downloads folder on my iPad like I have on my android phone and my windows PC. I do see that some of the other apps on my iPad have their own data folders that I can browse using finder. Also, my app never asks me to grant permission to access the downloads folder.

      In case it helps, my app uses QStandardPaths to choose the location. On iOS, I have success with opening files using QStandardPaths::AppDataLocation but not with QStandardPaths::DownloadLocation (both of these worked fine on android).

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 6 Mar 2021, 19:19 last edited by
        #4

        iOS security model is not the same as Android and it does not expose the system's ressources in the same manner.

        Did you check the entitlements in Xcode ?

        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
        • K Offline
          K Offline
          kgregory
          wrote on 6 Mar 2021, 23:43 last edited by
          #5

          I don't see any security, sandbox mode, or other file-related things in the capabilities menu, which as far as I can tell is where entitlements are in xcode now for iOS.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 7 Mar 2021, 21:06 last edited by
            #6

            macOS and iOS are two different beasts. I think you should take a look at this:
            https://developer.apple.com/documentation/uikit/view_controllers/providing_access_to_directories

            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
            • K Offline
              K Offline
              kgregory
              wrote on 8 Mar 2021, 04:38 last edited by
              #7

              Before seeing this reply, I figured out that the reason it wasn't working is because the downloads folder at the path that came form QStandardPaths didn't exist. Now my app can read and write those files. However, I can't find it through the iPad browser or when I try to browse on my mac. I think that I can't find it because the the path I'm using now from QStandardPaths is part of the app's sandbox.

              Anyway, I'll have to implement a file dialog to try your solution. Would QFileDialog do the trick?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 8 Mar 2021, 23:03 last edited by
                #8

                QFileDialog uses the system dialog by default on systems that provide one. I am currently unsure that it will fit your use case but I haven't used it directly on iOS for a long time.

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

                K 1 Reply Last reply 10 Mar 2021, 04:34
                0
                • S SGaist
                  8 Mar 2021, 23:03

                  QFileDialog uses the system dialog by default on systems that provide one. I am currently unsure that it will fit your use case but I haven't used it directly on iOS for a long time.

                  K Offline
                  K Offline
                  kgregory
                  wrote on 10 Mar 2021, 04:34 last edited by
                  #9

                  @SGaist well FileDialog doesn't seem to do the trick, I'm still restricted to the app's sandbox. I really have no idea how to implement the objective-C controller in QT. Any suggestions?

                  P 1 Reply Last reply 12 Apr 2024, 08:30
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 10 Mar 2021, 21:28 last edited by
                    #10

                    Did you already do Objective-C++ ?

                    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
                    • K kgregory
                      10 Mar 2021, 04:34

                      @SGaist well FileDialog doesn't seem to do the trick, I'm still restricted to the app's sandbox. I really have no idea how to implement the objective-C controller in QT. Any suggestions?

                      P Offline
                      P Offline
                      p_zirker
                      wrote on 12 Apr 2024, 08:30 last edited by
                      #11

                      @kgregory Even this topic is old, I've stumbled over it and had similar issues: For me it seems that you'll still stay in the sandbox anyway. The Dialogs might help to get access to outside folders.
                      This answer is giving a very usefull example on native code: https://stackoverflow.com/questions/46588201/no-files-found-on-ios-devices-qt-creator-c-qstandardpathsstandardlocationsq
                      With the use of the simulator you can check the filesystem of iOS and have a peek on what is going on. I've found that the native code of the example also does not leave the sandbox. It's about the project settings (namely the Info.plist's UIFileSharingEnable bool (true)) that is exposing your sandbox at least to the iOS file app.

                      1 Reply Last reply
                      0

                      • Login

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