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

File size and mime type are not correctly obtained with iOS simulator

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: Core: I/O
    • Environment:
      macOS 10.15
    • Platform/s:
      iOS/tvOS/watchOS, macOS

      Description

      The following code fails to access certain information such as file size and mime type on iOS simulator.
      This works fine with an actual device.

      Sample project is attached : qtbug90844-sample.zip
      NSPhotoLibraryDescription is defined in Info.plist.

      Code

         QMimeDatabase md;
       
         QString dir = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last();
         QString selectedFile = QFileDialog::getOpenFileName(&window, "Select image", dir);
         qDebug() << "Selected file: " << selectedFile;
       
         QFileInfo info(selectedFile);
         qDebug() << "Exists: " << (info.exists() ? "true" : "false");
         qDebug() << "Filename: " << info.fileName();
         qDebug() << "Path: " << info.path();
         qDebug() << "Size: " << info.size();
         qDebug() << "Mimetype: " << md.mimeTypeForFile(info); 
      

      Actual result

      [4785:52808] Selected file:  "assets-library://asset/asset.HEIC?id=CC95F08C-88C3-4012-9D6D-64A413D254B3&ext=HEIC"
      [4785:52808] Exists:  true
      [4785:52808] Filename:  "asset.HEIC?id=CC95F08C-88C3-4012-9D6D-64A413D254B3&ext=HEIC"
      [4785:52808] Path:  "assets-library://asset"
      [4785:52808] Size:  0
      [4785:52808] Mimetype:  QMimeType("application/x-zerosize")
      

      Expected result

      [4785:52808] Selected file:  "assets-library://asset/asset.HEIC?id=CC95F08C-88C3-4012-9D6D-64A413D254B3&ext=HEIC"
      [4785:52808] Exists:  true
      [4785:52808] Filename:  "asset.HEIC?id=CC95F08C-88C3-4012-9D6D-64A413D254B3&ext=HEIC"
      [4785:52808] Path:  "assets-library://asset"
      [4785:52808] Size:  2790421
      [4785:52808] Mimetype:  QMimeType("application/octet-stream")
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              richard Richard Moe Gustavsen
              Reporter:
              nagrohn Nahomi Gröhn
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes