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. Puzzled by how to deal with iOS 8.1 "Data container" changes to app sandbox filesystem [Solved]
Forum Updated to NodeBB v4.3 + New Features

Puzzled by how to deal with iOS 8.1 "Data container" changes to app sandbox filesystem [Solved]

Scheduled Pinned Locked Moved Mobile and Embedded
8 Posts 2 Posters 3.8k Views 1 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.
  • timdayT Offline
    timdayT Offline
    timday
    wrote on last edited by
    #1

    I have an Qt+QML app built with Qt 5.3.1 running nicely on an iOS 7.1 iPad (and working just as well on Mac and Linux platforms with negligible #ifdef-ed code sections).

    However, trying it out on an iOS 8.1 iPad for the first time, it seems to have some trouble finding files it finds no problem on iOS 7.1.

    Basically, on iOS 7.1 as I understand it the app starts with its current directory in the app bundle, and the app's sandbox's Documents and Library directories (where the app expects to access and manage some files) are simply found at ../Documents and ../Library. That's worked well for me so far anyway.

    I haven't completed a thorough investigation yet, but on iOS 8.1 the app no longer seems to be able to locate these dirs or at least the files within them via those paths. I strongly suspect this is related to something mentioned in the "iOS 8.1 release notes":https://developer.apple.com/Library/ios/releasenotes/Miscellaneous/RN-iOSSDK-8.1/index.html : "The file system layout of app containers has changed on disk. Rather than relying on hard-coded directory structure..." and then the rest is NS* gobbledegook to me but appears to show some API calls an app is expected to make to obtain paths to these directories.

    Looking at Apple's File System Programming Guide's "File System Basics":https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html section I am pretty sure the mention of a "Data Container" in the sandbox is something new since I last looked at it (yup in fact checking the wayback machine's version of that page for March 2013 I see the app bundle and Documents, Library etc dirs are just shown side by side in the sandbox; no mention of any "container".)

    Can anyone enlighten me if there's some simple Qt way of obtaining a path to an app's Documents and Library folders, or the "Data container"'s root? Worst case it looks like it may need some native Objectionable-C coding to prod these APIs, but maybe there is some Qt API for it already I've missed... for example it seems like the sort of thing there ought to be a QDir static member for (or what does QDir::home() return on iOS, for example?) Alternatively, is there just some URL file:// notation which can access it? Or are there any changes post Qt 5.3.1 which would make ../Documents work transparently again?

    Thanks for any tips
    Tim

    1 Reply Last reply
    0
    • timdayT Offline
      timdayT Offline
      timday
      wrote on last edited by
      #2

      Aha just noticed "QStandardPaths":http://qt-project.org/doc/qt-5/qstandardpaths.html which seems like exactly what you'd expect to tell you where to find some Documents & Library directories.

      However, while it mentions all of OS X, Windows, Blackberry, Linux and Android... no iOS! Wonder if it does anything sensible/useful there...?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        The doc seems incomplete, you can use QStandardPaths on iOS without any problem.

        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
        • timdayT Offline
          timdayT Offline
          timday
          wrote on last edited by
          #4

          OK confirmed (logging to stderr) that on iOS7:

          • QStandardPaths Documents locations: /var/mobile/Applications/<uuid>/Documents
          • QStandardPaths Data locations: /var/mobile/Applications/<uuid>/Documents] (surprisingly! More on this below)
          • QStandardPaths Cache locations: /var/mobile/Applications/<uuid>/Library/Caches

          Haven't checked iOS8 yet because xcode5 is refusing to talk to my iOS8 iPad (says I need an iOS8 SDK, which seems to imply installing xcode6 but I'm a bit "wary":http://stackoverflow.com/questions/25945878/cannot-compile-qt-with-xcode-6-0-1 of going there for now. However xcode5-compiled .ipa files still seem to be installable/runnable on iOS8 just fine so the easiest thing is just to try and use the QStandardPaths in my app and see if it works better than it does currently.

          One thing which quite surprised me: the "Data" QStandardPath location is also returning "Documents" and not "Library" or "Library/Application Support" which is what you'd expect from Apple's "documentation":https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html (see "iOS Standard Directories: Where Files Reside"). I also note that on OSX the QStandardPaths Library location is "~/Library/Application Support/<APPNAME>", "/Library/Application Support/<APPNAME>"... so I'm dubious the iOS result is correct/useful/appropriate (checked on Qt 5.3.2).

          1 Reply Last reply
          0
          • timdayT Offline
            timdayT Offline
            timday
            wrote on last edited by
            #5

            I see there's a Jira issue for the missing iOS QStandardPaths docs: "QTBUG-36171":https://bugreports.qt-project.org/browse/QTBUG-36171

            There wasn't one for the Data location is Documents/ thing; this seems wrong enough to me to create "QTBUG-42276":https://bugreports.qt-project.org/browse/QTBUG-42276

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Indeed, there's some inconstancies here. Thanks for the report

              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
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Fixes on the way

                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
                • timdayT Offline
                  timdayT Offline
                  timday
                  wrote on last edited by
                  #8

                  Thanks; will mark this a Solved.

                  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