- Qt 5.3
- Qt for iOS
- Qt 5.3.2 Reference Documentation

# Qt for iOS

Qt's iOS port allows you to run Qt applications on iOS devices, such as iPhones and iPads.

## Getting Started

Development and deployment is done using Xcode. The supported workflow is to maintain a `.pro` file based project, export it to Xcode (and re-export when the project setup changes), and then build and deploy using Xcode. We will look at that in more detail in the next section.

The minimum deployment target for Qt applications is iOS 5.0. Qt then supports the following devices (iOS might need to be upgraded on some devices).

- iPhone 3GS and later
- iPod Touch third and later generations
- iPad 2 and later
- iPad Mini

### Setting Up the Development Environment

You can download the Qt 5 installers from the Downloads page. For more information, see Getting Started with Qt.

Note: Qt Enterprise packages are available from the Try Qt Enterprise page. Qt for iOS is also available as part of the Qt Mobile Edition, see qt.digia.com for details.

Before installing Qt, you first need to install Xcode. You will find it in the Mac App Store here.

Note: As required by Apple, you should always use the latest Xcode 5 version when building your applications for the App Store. In practice this means you need OS X 10.8 or 10.9 to do iOS development with Qt, as those are the only platforms where Xcode 5 will run.

For running Qt applications in the simulator that comes with Xcode, this is all you need. However, for running applications on a device and publishing your applications in the App Store, you must join the iOS Developer Program (see https://developer.apple.com/programs/ios/), 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 on iOS consists of maintaining a normal `.pro` file project and export it to Xcode.

Here is how to build a project:

- run qmake (if you have not done so previously)
- open the resulting `.xcodeproject` 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 iOS applications in Qt Creator's manual:

- Connecting iOS Devices.

As mentioned previously, you must have Xcode installed.

### 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.

## Using Objective-C Code in Qt Applications

Clang, the compiler used for iOS applications, allows mixing C++ and Objective-C code. To enable this mode, suffix your source files with .c mm, and add them to `OBJECTIVE_SOURCES` instead of `SOURCES` in the `.pro` file. This makes it possible to use frameworks from Apple's iOS Developer Library in Qt applications. Most useful is perhaps the possibility for adding In-App Purchasing with the StoreKit framework.

We currently have one example mixing Objective-C and C++ code. You find it here.

## Related Topics

The following topics provide more details about Qt for iOS:

- Porting a Qt Quick Application
- Platform Notes
- Qt for iOS - Building from Source