Qt for iOS
Qt's iOS port allows you to run Qt applications on iOS devices, such as iPhones, iPads, and iPod Touches.
The following configurations are supported.
|iOS 14, 15, 16
|Xcode 14 (iOS 16 SDK)
Qt supports you in building, testing, and deploying applications for iOS. Qt applications are typically defined using the CMake or qmake build tools. Both tools can generate an
.xcodeproj file that can then be loaded and built from the command line, or with Xcode. Qt Creator also directly supports building, running, debugging, and profiling CMake and qmake projects for iOS.
The minimum deployment target for Qt applications is specified in Supported Platforms.
Before installing Qt, you first need to install Xcode. You will find it in the Mac App Store here.
Note: As recommended by Apple, you should always use the latest Xcode version when building your applications for the App Store. In practice this means you also need the latest version of macOS to develop apps with Qt, due to Xcode's system requirements.
For running Qt applications on your Mac or in the simulator that comes with Xcode, this is all you need. However, for running applications on a mobile device and/or publishing your applications in the App Store, you must join the Apple Developer Program, and set up developer certificates and provisioning profiles. The easiest solution is to use a profile that takes any App ID (a
Before building any Qt applications, you should test that Xcode is set up correctly, for example, by running one of the standard Xcode application templates on your device.
Use CMake or qmake to define how to build your iOS application. Both CMake and qmake can generate an
xcodeproj file, which can then be loaded and built from the command line.
qt-cmake convenience script located in
<Qt-dir>/<version>/ios/bin/ will take care of setting up the toolchain and correct architectures for you.
qt-cmake convenience script:
Using the generated
xcodeproj file, you can either use Xcode to build your application or run
xcodebuild from the command line. For a list of available targets and schemes for your application, run the following command:
xcodebuild -list -project <your-app>.xcodeproj
xcodebuild build, passing in your application details:
xcodebuild build -allowProvisioningUpdates -project <your-app>.xcodeproj -scheme <your-scheme> -configuration Debug -destination "generic/platform=iOS" -destination-timeout 1 ENABLE_ONLY_ACTIVE_RESOURCES=NO
First, define how to build the application using qmake. Then, use the generated
xcodeproj file to build the application, either in Xcode or from the command line.
qmake creates a wrapper Makefile that in turns calls
xcodebuild, so you can run
make to build your application:
Note that you must re-import the project if its setup changes, for example, when adding or removing source files.
QMAKE_MAC_XCODE_SETTINGS qmake variable can be used to customize Xcode settings, for example:
development_team.name = DEVELOPMENT_TEAM development_team.value = <your-team-id> QMAKE_MAC_XCODE_SETTINGS += development_team
Other qmake variables are also useful:
QMAKE_TARGET_BUNDLE_PREFIX = com.<your-company> QMAKE_BUNDLE = <your-app>
You can find information on how to set up and run Apple mobile device applications in Qt Creator's manual:
As mentioned previously, you must have Xcode installed.
The Xcode projects generated by qmake and CMake support running the application on both iOS devices and in the iOS simulator.
Note: As the default architecture of the Qt for iOS simulator libraries is
x86_64, the application must run under Rosetta on Apple Silicon Macs. If the Rosetta-based run destinations are not listed in Xcode's run destination menu they can be enabled via the
Product > Destination > Destination Architectures menu.
Clang, the compiler used for applications on Apple Platforms, allows mixing C++ and Objective-C code. To enable this mode use the
.mm extension for the relevant source files and add them to your project as usual.
target_sources(myapp PRIVATE objc_code.mm)
SOURCES += objc_code.mm
You can then use Objective-C frameworks from Apple's Developer Library in your Qt applications.
To expose functionality to the rest of your application, without having to rename all your source files, declare helper functions in a header, and implement the functionality in an Objective-C++ source file:
In Qt Creator, tested examples on iOS can be looked up. Use the
ios keyword to search for examples in the Qt Creator Welcome mode. Note that some examples may have limited functionality.
For a list of examples known to work on iOS devices, visit Qt for iOS Examples.
The following topics provide more details about Qt for iOS:
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.