Qt for iOS
Qt's iOS port allows you to run Qt applications on iOS devices, such as iPhones, iPads, and iPod Touches.
Supported Configurations
The following configurations are supported.
Target Platform | Architecture | Build Environment | Notes |
---|---|---|---|
iOS 12, iOS 13, iOS 14, iOS 15 | armv8 (arm64 ) | Xcode 11 (iOS 13.2 SDK), Xcode 12 (iOS 14 SDK), Xcode 13 (iOS 15 SDK), Xcode 14 (iOS 16 SDK) | |
tvOS 12, tvOS 13 | armv8 (arm64 ) | Xcode 11 (tvOS 13 SDK) | Technology Preview |
watchOS 5, watchOS 6 | armv7k | Xcode 11 (watchOS 6 SDK) | Technology Preview. No UI. |
Getting Started
Development and deployment is done using Xcode. The supported workflow is to maintain a .pro
file based project, which generates an Xcode project. Building and deploying can be done using either Xcode or Qt Creator. We will look at that in more detail in the next section.
The minimum deployment target for Qt applications is specified in Supported Platforms.
Setting Up the Development Environment
You can download the Qt 5 installers from the Downloads page. For more information, see Getting Started with Qt.
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.
Building Applications From the Command Line
As mentioned previously, the development workflow consists of maintaining a normal .pro
file project and exporting it to Xcode.
Here is how to build a project with Xcode:
- run qmake (if you have not done so previously)
- open the resulting
.xcodeproj
file in Xcode - build the application in Xcode
Note that you must re-import the project if its setup changes, for example, when adding or removing source files.
Building Applications with Qt Creator
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.
Using Objective-C Code in Qt Applications
Clang, the compiler used for applications on Apple Platforms, allows mixing C++ and Objective-C code. To enable this mode, suffix your source files with .mm
, and add them to OBJECTIVE_SOURCES
instead of SOURCES
in the .pro
file. This makes it possible to use frameworks from Apple's Developer Library in Qt applications. Most useful is perhaps the possibility for adding In-App Purchasing with the StoreKit framework.
Examples for iOS
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.
Related Topics
The following topics provide more details about Qt for iOS: