Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to actually get started with Qt5.2 qmake/xcode/ios simulator on Mac? [solved]
timday last edited by
I have been using Qt on desktop platforms for years (since Qt3). Having been doing quite a bit of mimimal QtQuick/QML stuff recently (love it! finally, the holy grail of integrating performant native C++ with rapid, dynamic UI development done right), I'm interested to try out Qt5.2's newfangled ios support (which would be my first venture into anything "mobile"). I'm having trouble figuring out how to build anything but the usual MacOS apps though.
- a mid 2012 MacBookPro with MacOS 10.8.5
- xcode 5.1 installed, and the commandline tools updated
- Qt 5.2.1 http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-mac-x64-ios-5.2.1.dmg installed from "Qt 5.2.1 for iOS (Mac, 909 MB)" link at http://qt-project.org/downloads
For starters, I'll settle for something really simple; this test.pro:
@TEMPLATE = app
TARGET = test
CONFIG += debug
QT += core gui quick
SOURCES += main.cpp@
int main(int argc,char *argv)
(of course there's also a test.qml but it's irrelevant here) and then I try and build it with
@qmake -spec macx-xcode test.pro @
which gets me a test.xcodeproj/ created, and then
@xcodebuild -project test.xcodeproj -alltargets@
builds a bunch of stuff... but just yields a MacOS app, albeit one which runs as expected on the Mac with ./Debug/test.app/Contents/MacOS/test.
The qmake used is definitely the one from the "Qt 5.2.1 for iOS" install.
So, what do I do to change in the above to get ios executable I can run with xcode's ios simulator (including, ideally, launching the simulator from the commandline) ?
Haven't had much luck googling for solutions; everything I've found seems to just say "and then you open the xcodeproj file in xcode and build it". I've tried that and (once I figured out the project needed to be added to a workspace) it just builds me a MacOS app too, which leads me to suspect the qmake needs to be doing something, but if it was as simple as a different -spec argument I'd have thought I'd have discovered that. (BTW, I've never used xcode before and would rather interact with whatever it brings to ios building via commandline & scripting if at all possible). In xcode I seem to be able to click around various project properties and there are a bunch which could be changed to ios... but at this point I'm rapidly out of my depth and from I have seen, I get the impression things are supposed to be simpler (unless it's just a matter of setting one target setting somewhere I've missed).
Thanks for any pointers; have a feeling I must be just missing something really basic here...
I haven't used the packaged version for iOS but I suspect you should have three version of qmake, one for the OS X build that you are currently using and another two for the iOS builds of Qt (simulator/device). Search for qmake in your installation folder and use the one specific for the simulator/device (depending on which you want to target) to create the Xcode project.
You then have two choices Qt Creator's iOS plugin or Xcode (just build and run nothing more to do there).
AFAIK Apple doesn't provide any command to upload/deploy iOS application but you can find some tools that have been written by others for that.
Hope it helps
timday last edited by
Aha! Yes, there is another qmake lurking in 5.2.1/ios/bin ! I was still using the 5.2.1/clang_64/bin one.
Using that, the commandline build fails at the end with something about a code signing error for an iOS application (ok, I'm not registered Apple dev yet), but I can open the xcodeproj fine in xcode and run it on the simulator (ok, minor detail of all it does is log that it failed to find the QML file but that'll be easily fixed by copying it into app bundle or a qrc).
Anyway, that's unblocked me; thanks for the pointer!
AFAIK, the most common way is qrc, it's the most cross-platform solution.
If you want to target a device, then indeed you'll need to register. Also, you can't test everything on the simulator it doesn't provide everything a device does.
You're welcome !
Since you can go further now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)