Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-126438

(Image) files from assets-library:// are not accessible in iOS 17

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15
    • QPA
    • None
    • iOS 17.4 and 17.5, Qt 5.15.16, current XCode Version.
    • iOS/tvOS/watchOS

    Description

      The Native image picker (with a QFileDialog pointing to QStandardPath::standardLocations(QStandardPath::PicturesLocation).last()
      (which is always assets-library://))  is returning a single file path like

      assets-library://asset/asset.JPG?id=ED7AC....4f2ED&ext=JPG

      While not in the Platform notes, I needed to manually load the backend into the projects qmake with QTPLUGIN += qiosnsphotolibrarysupport

      When using returned the file-path with QFileInfo, the instance can be created, but accessing any details (even exists() ) is resulting in a unlogged crash. An upfront inspection is showing "not acessible" in most fields. I Assume there might be some detail-logs on iOS side but have not looked yet.

      I also changed the formatting of the file and in those cases, the QFileInfo is stating that the file does not exists. I also checked the formatted versions used in QML with a leading file:/ and a replaced "?" for proper encoding: either crash or no file.

      Also using QDir on assets-library:// and getting an info list is returning an empty directory.

       NSPhotoLibraryUsageDescription i info.plist is set, if not, the native picker won't appear rather the generic file Dialog.

      Since there are not much details on how to access the images at the platform-notes and they are rather old, there was an update at iOS some versions ago that might have been missed:

      Having some hints on the deprecation of the assets-library https://developer.apple.com/documentation/assetslibrary while still getting this path returned, i believe the QT plugin might be deprecated too? (using 5.15.16)
      I think the plugins code needs to use PhotoKit backend https://developer.apple.com/documentation/photokit/selecting_photos_and_videos_in_ios

      The mandate of using PhotoKit instead started with iOS 15.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            p_zirker Patrick Zirker
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes