Qt World Summit: Register Today!

FileDialog on iOS only works in portrait mode. Crashes otherwise.

  • If I set FileDialog's folder to shortcuts.pictures when the app is in landscape mode, it flips to portrait mode before showing the OS builtin image picker. If the app is set to only use Landscape mode, Qt crashes:

    MyApp[808:282060] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES'

    Is this a bug or am I missing something?

  • Lifetime Qt Champion


    Can you provide a minimal compilable example that shows that behavior ?

  • @SGaist Just create anything using Qt Creator's wizard:


    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    int main(int argc, char *argv[])
        QGuiApplication app(argc, argv);
        QQmlApplicationEngine engine;
        return app.exec();


    import QtQuick 2.7
    import QtQuick.Window 2.2
    import QtQuick.Dialogs  1.2
    import QtQuick.Controls 1.3
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        FileDialog {
            id:             filePicker
            title:          "Please choose an image file"
            folder:         shortcuts.pictures
            visible:        false
            nameFilters:    [ "Image files (*.jpg *.png)", "All files (*)" ]
            onAccepted: {
                console.log("You picked: " + filePicker.fileUrl()
        Button {
            anchors.centerIn: parent
            text: "Pick An Image"
            onClicked: {

    Note that you need to add some keys to the .plist file. Either through Xcode or creating your own .plist and adding to your .pro file.

    	<string>Foo Bar</string>

    Everything using the latest version (Qt Creator 4.1.0, Qt 5.7, Xcode 8.0, etc.)

  • Lifetime Qt Champion

    Sorry, I couldn't test.

    Since there has been new releases in between can you check with them ? 5.7.1 is out and 5.8 Beta also.

Log in to reply