Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt 5.2 beta 1 / iOS / QtQuick 1.1 and 2.0



  • I'm sorry... I read wrongly the information on the bug report.
    The problem is still into the beta 1 release, and they are going to solve it to the "next minor release" ... that it should the 5.2.1 ??? If so we have to wait another few months for get full support of qt quick 2 into iOS platform.



  • I also got this issue.
    Waiting for the update fixed this this bug.



  • Hello,

    it is not working for me either.

    Does anybody know a workaround for this ?

    Regards,

    DaBoba



  • Hello,
    I trying a way to workaround the bug.
    There are some interesting tries into the comments of the QTBUG-28357 but none of them has been tryied on iOS.
    I'll let you know if I'll find a workaround.
    I also invite you to try some workarounds, so we can find it faster.



  • Hello,
    I found a workaround !! Yuuuhhuuuu !!! Now my Qt Quick 2 game works perfectly on iOS with Qt 5.2.0 Beta 1 :-)

    The solution is:
    In the .pro add the following only for iOS platform:

    @
    LIBS += -L$$[QT_INSTALL_LIBS]/../qml/QtQuick.2/
    QTPLUGIN += QtQuick2Plugin
    @

    In the main.cpp add the following code before the main:

    @
    #ifdef Q_OS_MAC
    #include <QQmlExtensionPlugin>
    Q_IMPORT_PLUGIN(QtQuick2Plugin)
    #endif
    @

    and the following code inside the main for creating the QtQuick view:

    @
    #ifdef Q_OS_MAC
    qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuick2Plugin().instance())->registerTypes("QtQuick");
    QtQuick2ApplicationViewer viewer;
    viewer.engine()->setImportPathList(QStringList());
    #else
    QtQuick2ApplicationViewer viewer;
    #endif
    @

    And magically the Qt Quick 2 works on iOS.



  • Thank you very much Gianluca! This workaround works fabulous!

    Although I had to leave

    @viewer.engine()->setImportPathList(QStringList()); @

    away to compile correctly.



  • You should be using Q_OS_IOS for iOS. The Q_OS_MAC might work for now, but it also includes OSX, and isn't guaranteed to work in the future for iOS.



  • For the people that have successfully tried this workaround...are you deploying to an actual device or the iOS Simulator? For me, this works fine on the device, but when I try to compile for the simulator I get a ton of 'duplicate symbol' linker errors. Seems to be lots of conflicts between Qt5Qml/Qt5Quick and Qt5Declarative. Has anyone else run into this or have suggestions for fixing it?



  • I'm currently only deploying on the devices and not on simulators!



  • @ dbrian: not sure if you are aware, but if you want to run this on the simulator, you'll have to run qmake from Qt 5.2.0 (ios_x86), while if you want to run on an actual device, you need to run qmake from Qt 5.2.0 (ios_armv7) tool chain.

    @Gianluca: Yes that worked perfectly, i was finally able to run a QtQuick2 application.

    Now the bad part is, for some reason it stopped working for any Qt application beginning of this month, I thought my tool chain was broken, so I restored my Mac via "Time Machine" to a point, when the toolchain definitively worked, but no success. I was able to run the app via XCode on the device, and once done, I could start that same app again, but I when I created an IPA using a provisioning profile, the IPA did install on the device, but when started, the only thing was the black screen and then the app stopped. Console log showed exited abnormally with exit status 255. This was with qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-10-23_08-56-32-110.dmg .
    Weird... the only change I did on Apple side, I had to change/update a provisioning profile. I am still able to successfully deploy and start native iOS apps, so it's not a matter of corrupted provisioning profiles. They just seem to have stopped working with Qt apps...

    So I tried the latest build qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-11-05_13-03-56-133.dmg , now the app deploys correctly and starts up, but now it stalls with a black screen, on the debug output is the message Failed to find shader ":/scenegraph/shaders/opaquetexture.vert" .



  • Ok, got an older version (tested with qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-10-18_08-24-56-104.dmg), that worked



  • For what it's worth, here is another workaround I figured out that doesn't require any changes to your .pro file or source code.

    Create a .qml file in the same directory as your .pro file where you declare any qml imports your application requires.

    @
    /*
    imports.qml

    Declaration of QML Imports 
    required by project.
    
    This is necessary if we want 
    to keep qml files in a folder
    separate from .pro file because 
    of the way qmlimportscanner works.
    If these imports are not declared, 
    qmake will not recognize them,
    and QtQuick will not be packaged 
    with statically built apps (i.e. iOS)
    and imported at runtime.
    
    This must be kept in the same 
    directory as your .pro file
    

    */

    import QtQuick 2.1
    import QtQuick.Window 2.1
    //import etc, etc, etc.

    QtObject {}
    @

    I came to this solution because I found that I was able to build/deploy most of the example QtQuick2.0 apps to a device/simulator without any issue, but my own apps were throwing a 'QtQuick not installed' error on deployment. This seemed really strange to me so I dug into the source and found that qmake uses a tool called qmlimportscanner and attempts to locate any qml imports by parsing qml files in the directory of the .pro file for 'import ...' statements. Then qmake automatically sets up the appropriate lib dependencies for static builds. Since I like to keep my .qml files in a separate directory, qmake didn't know I had dependencies on the QtQuick plugins. Putting this file there helps qmake figure out what libraries/plugins it needs to bundle with your app

    Hopefully this helps someone. If you want to look into it yourself, the relevant qmake code is in qt.prf (search for '# static builds: link qml import plugins into the app.').



  • i am having the same issue than edmon. I tried and tried look and look but always the same result. When I run the app with qt creator everithing works perfect but if I try to generate the .IPA file and install the app with iTunes. Always the same result, black screen for few seconds and then closes in the console it says : exited abnormally with exit status 255
    I tried with several versions and different configurations in XCode, could somebody give me a hint.

    I really dont know where even keep looking for the info.

    Thanks



  • Hi devuser,

    I found out the for some reason some Qt builds were somehow broken, running on simulator and running on the device through XCode was working fine, but when installed from an IPA, it did not, so I went back and tested for older Qt builds. I found the following builds to be working with IPA installation:

    • Build 104: qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-10-18_08-24-56-104.dmg
    • Build 106: qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-10-20_13-21-35-106.dmg

    I foung e.g. Builds 109 and 110 not to be working with IPA deployment. I recently did not have the chance to test for newer builds, as of today it looks like Builds 135 and later are available on the "beta1":http://download.qt-project.org/snapshots/qt/5.2/5.2.0-beta1/ path, and there is also now the "rc1":http://download.qt-project.org/snapshots/qt/5.2/5.2.0-rc1/ path available, you may want to try those.



  • could you tell me the process you follow to get the IPA with one of those please. It is very important for me. I really will be very grateful.

    Thanks you very much



  • After installing the Qt5 package, the following toolchains are available:

    Qt 5.2.0 (ios_x86): use this tool chain if the resulting code is supposed to be tested with XCode's device simulator

    Qt 5.2.0 (ios_armv7): use this tool chain if the resulting code is supposed to be tested or to be deployed to an actual device

    Here is the proceeding as I use to generate the IPA:

    open your Qt project with QtCreator

    make the adaptions if using QtQuick2 (Gianluca's solution as of October 30, 2013)

    select the appropriate tool chain for the intended purpose, i.e. for generating simulation or deployment code

    run qmake from QtCreator's menu. This will create a shadow build for the selected tool chain containing an XCode project file, e.g. MyProject.xcodeproj

    open that generated XCode project file, this will invoke XCode

    in the Summary tab in section iOS Application Target, change the Bundle identifier to your need, currently it defaults to com.yourcompany.<appname>. This is imoportant for deployment to match the app with a defined App ID in the Apple Developer Member Center

    change other app specific settings if needed, e.g. the supported device orientation

    start compilation from within XCode

    continue as for a standard (native) iOS application, either run it on simulator, run it on a connected device or deploy it (generate an IPA file)

    To generate the IPA (the following is valid for XCode 4.6.3):

    build and archive the code in XCode

    switch to XCode Organizer into Section "Archives"

    select the archive you just generated and click on the button "Distribute..."

    select the intended method of distribution, e.g. "Save for Enterprise or Ad-Hoc Deployment" and click "Next"

    select the "Code Signing Identity" and click "Next"

    select a location to store the generated IPA file

    Voilà, there is your IPA file



  • again thanks very much



  • For what it's worth, I just ran into this problem out of the blue (despite having previously had QML stuff working on the iPad simulator) after I nuked a build area. (On MacOS 10.8 using the Qt5.2.1 for ios).

    One thing which had changed in the development area's history: I'd moved the qml files into a subdirectory (relative to the .pro file).

    I just followed dbrian's advice and created a near identical imports.qml adjacent to the .pro... and ta-da... back in action again.



  • Another FWIW: The 'imports.qml' file I mentioned above doesn't seem to be necessary anymore in Qt 5.3. Maybe the build system is now searching deeper in the project hierarchy for import statements.



  • @dbrian said in Qt 5.2 beta 1 / iOS / QtQuick 1.1 and 2.0:

    Create a .qml file in the same directory as your .pro file where you declare any qml imports your application requires

    Amazing. It is now 2020 (7 years have passed), and this "imports.qml" trick still solved my iOS/qmake issue today. Thanks, from the future ;)


Log in to reply