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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.15.2
    • Core: I/O
    • macOS 10.15
    • 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

              richard Richard Moe Gustavsen
              nagrohn Nahomi Gröhn (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes