Qt 5.2 beta 1 / iOS / QtQuick 1.1 and 2.0
-
Hi everybody,
just installed the latest 5.2.0 beta 1 snapshot for iOS (qt-mac-opensource-5.2.0-beta1-ios-x64-offline_2013-10-14_15-02-04-93.dmg) and ran into a few issues. I am wondering if I am doing something odd, but I did not find any "HowTo" documentation, here is what I've done:
- I set up a project using QtQuick 1.1 and a very simple QML (inside an qrc) file showing a TextInput field. I got this running on. The QML is invoked using auto-generated qmlapplicationviewer and in main.cpp with
@viewer.setSource(QUrl("qrc:/qml/Test.qml"));
@
The QML:
@Rectangle {
width: 800
height: 600Rectangle { id: rectInput width: 100 height: 40 border.width: 1 border.color: "blue" TextInput { anchors.fill: parent id: testInput text: "Test" MouseArea { anchors.fill: parent onClicked: { testInput.focus = true testInput.openSoftwareInputPanel() console.log("TextInput:<<<<<<<<<<<<<<<<<<<<<<<<<<<") } } } }
}@
Then I run qmake and open the generated xcodeproj in XCode, build and run in simulator. The app starts up, but clicking on the TextInput field does no effect, no keyboard on screen shows up. The lines
@testInput.focus = true
testInput.openSoftwareInputPanel()@were added later, but still no effect, still no keyboard showing up.
- I alternatively tried to use QtQuick 2.0 and auto-generated qtquick2applicationviewer, ran qmake and opened the generated xcodeproj in XCode, built and ran it on the simulator, but then on the debug output I got
qrc:/qml/Test.qml:1:1: module "QtQuick" is not installed
although in XCode in section Frameworks Qt5Quick is shown. As Qt5.2.0 beta 1 is said to support QtQuick 2 in iOS I am wondering why it is not found.
Just wondering if anyone else ran into the same issues or if I am missing here something.
Thanks in advance.
- I set up a project using QtQuick 1.1 and a very simple QML (inside an qrc) file showing a TextInput field. I got this running on. The QML is invoked using auto-generated qmlapplicationviewer and in main.cpp with
-
Those look like good candidates for bugs. You can ask on interest/ development Mailing List just to be sure, then please report it on "Jira":https://qt-project.org/wiki/ReportingBugsInQt.
Qt Project team is very interested in any input regarding the beta, so you have a good chance of being heard.
-
It is a known bug !!
https://bugreports.qt-project.org/browse/QTBUG-28357
For long time, and they think that has been solved in the 5.2.0 beta1.But we should open again that bug because it is still there.
The bug appear also on iOS because the libraries are built statically.
-
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. -
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.
-
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?
-
@ 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" .
-
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.qmlDeclaration 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.
-
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