Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Error when accessing some photo albums on iOS

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #18833

    Javier

    I am using the NativeUtils image picker to get access to the device pictures. Most of the time it works fine, but I get an error when I try to access pictures located in some albums, for instance in the “Selfies” or “Live photos” albums. The error is the following.

    QML Image: Cannot open: file:assets-library://asset/asset.JPG%3Fid=7D73CD74-0073-4BB2-B975-A6E262A3B4C8&ext=JPG

    I already set on the ios/Project-Info.plist file the key for accessing to the photo library. I listen to the imagePickerFinished signal and check that accepted is true.

    <key>NSPhotoLibraryUsageDescription</key>
    <string>Select pictures for the user profile.</string>

    I tested this on an iPhone 7, iOS 11.2.1 and the lastest Felgo version.

    Any ideas?

    #18834

    Javier

    It seems that pictures in the “Selfies” album have the JPG extension, whereas some pictures in the “Live photos” album have the HEIC extension. Is this last format supported by the QML image component? Nevertheless, I am getting the same error with both photo albums.

    QML Image: Cannot open: file:assets-library://asset/asset.JPG%3Fid=7D73CD74-0073-4BB2-B975-A6E262A3B4C8&ext=JPG
    QML Image: Cannot open: file:assets-library://asset/asset.HEIC%3Fid=8AE1F0ED-7C5B-4FD7-8423-CE230615A9C1&ext=HEIC

     

    #18911

    Günther
    Felgo Team

    Hi Javier,

    I’m not able to verify the issue during a short test. I’m able to use all Images also from these folders. Can you provide a simple code sample and your Project-Info.plist for me to have a look?

    Best,
    Günther

    #18919

    Javier

    Hi Günther,

    It does not work for me even in a simple example. Am I doing something wrong?, I checked that it works sometimes with pictures located in the albums I previously mentioned, so perhaps the issue is not related to the albums themselves.

    import Felgo 3.0
    import QtQuick 2.10
    
    App {
        Connections {
            target: nativeUtils
            onImagePickerFinished: {
                if (accepted) image.source = path
            }
        }
    
        Image{
            id: image
            anchors.fill: parent
            autoTransform: true
            fillMode: Image.PreserveAspectFit
    
            MouseArea{
                anchors.fill: parent
                onClicked: nativeUtils.displayImagePicker(qsTr("Select picture"))
            }
    
            AppText{
                anchors.centerIn: parent
                text: qsTr("Click here")
            }
        }
    }

    The Project-Info.plist is the one by default

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>CFBundleDisplayName</key>
        <string>TestImagePicker</string>
        <key>CFBundleExecutable</key>
        <string>${EXECUTABLE_NAME}</string>
        <key>CFBundleIdentifier</key>
        <string>com.yourcompany.wizardEVAP.TestImagePicker</string>
        <key>CFBundleName</key>
        <string>${PRODUCT_NAME}</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>1.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>1</string>
        <key>UIStatusBarHidden</key>
        <true/>
        <key>LSRequiresIPhoneOS</key>
        <true/>
        <key>UIViewControllerBasedStatusBarAppearance</key>
        <false/>
        <key>CFBundleAllowMixedLocalizations</key>
        <true/>
        <key>UIRequiresFullScreen</key>
        <true/>
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UISupportedInterfaceOrientations~ipad</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>NSPhotoLibraryUsageDescription</key>
        <string>App would like to access the library.</string>
        <key>NSPhotoLibraryAddUsageDescription</key>
        <string>App would like to save images taken with camera.</string>
        <key>NSCameraUsageDescription</key>
        <string>App would like to access the camera.</string>
    </dict>
    </plist>

    The log

    stale focus object QObject(0x0) , doing manual update
    stale focus object QObject(0x0) , doing manual update
    file:///private/var/containers/Bundle/Application/CBCB90DE-4387-49F1-BFD3-8851D9FCC0A8/TestImagePicker.app/qml/Main.qml:12:5: QML Image: Cannot open: file:assets-library://asset/asset.JPG%3Fid=1F0E4ECD-5895-4C96-A173-C5B0E23C11F4&ext=JPG
    stale focus object QObject(0x0) , doing manual update
    file:///private/var/containers/Bundle/Application/CBCB90DE-4387-49F1-BFD3-8851D9FCC0A8/TestImagePicker.app/qml/Main.qml:12:5: QML Image: Cannot open: file:assets-library://asset/asset.HEIC%3Fid=685848AE-7CF4-4C19-BBA7-CFC44DC1E8ED&ext=HEIC

    When I select a picture, it takes some time and I can see a spinner over the picture which probably is manipulating the image (compressing or reducing it). I do not know if this can be related to the issue.

    #18923

    Javier

    Same errors happen with the Qt Quick FileDialog, so this is an issue related to Qt/QML or my particular configuration. It seems that the errors only happen with pictures taken from my mobile phone cameras. The pictures I received from others are always correctly opened, it is strange.

    import Felgo 3.0
    import QtQuick 2.10
    import QtQuick.Dialogs 1.3
    
    App {
        FileDialog {
            id: fileDialog
            title: "Select picture"
            folder: shortcuts.pictures
            onAccepted: image.source = fileDialog.fileUrl
        }
    
        Image{
            id: image
            anchors.fill: parent
            autoTransform: true
            fillMode: Image.PreserveAspectFit
    
            MouseArea{
                anchors.fill: parent
                onClicked: fileDialog.open()
            }
    
            AppText{
                anchors.centerIn: parent
                text: qsTr("Click here")
            }
        }
    }

    I am also getting the following warning from FileDialog when the app initializes

    QKqueueFileSystemWatcherEngine::addPaths: open: No such file or directory

     

    #18925

    Javier

    Ok, so the problem is loading pictures that were taken  with the “Optimize iPhone storage” option enabled, if I disable it I can load the new taken pictures without problems. Here, an screenshot of how to enable this feature.

    https://goo.gl/images/hnH2BV

    Can anyone reproduce this? Any idea how to solve this problem?

    #18930

    Javier

    I am also having similar issues (QML Image: Cannot open) with the camera picker, they are probably related to the “Optimize iPhone storage” option being enabled.

    #18958

    Alex
    Felgo Team

    Hi Javier,

    from the url, this does not look like an actual image format, which would explain the failed loading. We will have a look if we can add support for this type of image.

    Cheers,
    Alex

    #18962

    Javier

    Hi Alex,

    Do you mean this url format?

    file:assets-library://asset/asset.JPG%3Fid=7D73CD74-0073-4BB2-B975-A6E262A3B4C8&ext=JPG

    It was also strange to me, but it seems that it follows the url format standard, and QImage and QML Image support it.

    http://lists.qt-project.org/pipermail/interest/2017-October/028526.html

     

    Also, I checked that the pictures I can open follow the same url format, so I do not think is an issue with it. I Checked that the error only happen when you take pictures and have the “optimize iPhone storage” option enabled, because I think low-res thumbnails are stored in the device and high resolution pictures are uploaded to the cloud.

     

    When I select an image in the iOS image picker, it takes some time and I can see an spinner over the picture while the picture is probably being downloaded from iCloud. So, I think that something is missing in the QML FileDialog in this particular case, like waiting for the picture to be downloaded, this is a wild guess, but something is not working in this situation.

     

    Could you reproduce it?, thanks.

    Javier.

    #19123

    Javier

    Hi,

     

    any progress on this?, pherphaps I should report this as a Qt bug because it affects the QML FileDialog. Now, it is clear to me that this issue is related to the “optimize iPhone storage” option. I can replicate it with any app in my mobile phone, for instance with the Qt World Summit 2017 app when loading a profile picture.

    #19146

    Günther
    Felgo Team

    Hi Javier,

    this sounds like a Qt bug: The optimize iPhone storage setting loads/caches Images from the cloud to avoid photos filling up your phone space. Maybe the Qt Images do not support the used image format of Apple. Or there’s something wrong with the loading of the file – I think it’s best to report it as a Qt bug.

    Best,
    Günther

     

Viewing 11 posts - 1 through 11 (of 11 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded