Александр Панюшкин
Александр ПанюшкинDec. 25, 2019, 1:58 a.m.

Creating an iOS app in QtCreator

This article is a note to myself on the topic of creating an iOS application in the QtCreator environment.

Task: to make an application for iPhone/iPad, which can be uploaded to the AppStore. At the same time, use QtCreator tools as much as possible and Xcode minimally.

What we have:

  • MacBook Pro with macOS Catalina (ver.10.15.2) (any poppy will do, I don't know if it will work on virtual machines)
  • Xcode (ver.11.3) (required, nothing will work without it)
  • QtCreator (ver.4.10.2) and Qt 5.12.6 (latest LTS version at the time of writing)
  • iPhone 7 Plus for performance testing
  • Some amount of time, nerves and perseverance to figure everything out.

Run test application

The application for which I dealt with the issue of installation on iOS works with the user's map and geolocation, so for this article we will take the application from standard examples - Places Map (QML) ( link ).

We copy the example (we will make small additions to it) and open it in QtCreator.

We select a suitable whale (I did not use the simulator from QtCreator):

Configuration file

And the first thing we have to do is build the project.

Then we go to the build folder (in my case it is /Users/ap/Downloads/build-places_map-Qt_5_12_6_for_iOS-Debug) we take the Info.plist file from there, which we transfer to the ios folder, which we create in the root of our project.

We add the Info.plist file to our project.

We get the following project structure:

It remains to add our file to the assembly. To do this, add the following code to the *.pro file - places_map.pro:

ios {
    QMAKE_INFO_PLIST = ios/Info.plist

We make this addition only for the ios platform.

Now, when building the project, our Info.plist will always be used.

Version, company, executable

We make additions to the *.pro file. We add information about the version, our company and the name of the executable file (do not confuse the name that will be displayed to the user on the phone).

VERSION = 0.1.1

QMAKE_BUNDLE = "places_map"
TARGET = "places_map"

QMAKE_BUNDLE and TARGET point to the same thing. I did not understand the fundamental differences between them. And in general, they are not mandatory (unless it is important for you that the name of the executable file differs from the name of the project).

The version is required. Without a version, the project will not compile.

These options are not platform specific.

Minimum iOS version

In the *.pro file, you can also specify the minimum version of iOS on which your application will run.

> Much to my regret, I didn't find any signs indicating which versions of Qt components work with. It would be logical to assume that Qt itself will be able to calculate the minimum version during the build and substitute it, but, unfortunately, I had to act randomly. Perhaps I just did not find the necessary information and I will be glad if they tell me where to look for it.

To do this, add the following line to the ios *.pro section of the file:


In the above example, the minimum version is 9.0.

If the string is not specified, the most recent version will be substituted (currently it is 11).

Application name

> In a number of cases, I could not find a way to enter parameters only in *.pro file, I had to register directly in Info.plist. In my opinion, this is not entirely correct, so I will be grateful if they tell me how this data could be entered into * .pro and not touch Info.plist.

To change the name of the application (the name that the iOS user will see), you need to change the value (string) of the key (key) CFBundleDisplayName in the Info.plist file. For example, like this:

<string>Places Map</string>

Using geolocations

To use geolocation, microphone, camera, etc. services, you must specify a request for permission in the Info.plist file about this. This is done by adding special keys.

In case we need to request permission to use geolocation while using the app, we use the NSLocationWhenInUseUsageDescription key. In the key value, we must specify a description that will be visible to the user, in which we need to indicate the reason why we need this service. Without this description, your program may be blocked on the AppStore.

<string>This app uses a user's locations to find nearest pizza.</string>

More information about the keys used can be found in the iOS documentation.

Application icons

An important stage is the creation of application icons. Without them, your application will not be added to the AppStore.

Details on creating icons for different versions are described in the instructions on the qt.io website - https://doc.qt.io/qt-5/ios-platform-notes.html.

I made everything easier. We need a 1024x1024 file with our icon.

We go to the site https://www.iconsgenerator.com/Home/AppIcons (there are others, but this one generated all the necessary sizes, which other services could not boast of), upload our file and download the generated icons.

Let's get the Assets.xcassets folder (the name is not important, the extension is important), which will contain our icons and json files with attached sizes according to device types.

We add this folder to our project in the ios folder.

Then it remains for us to add information about our icons to the ios section of the * .pro file:

    QMAKE_ASSET_CATALOGS += ios/Assets.xcassets

Loading screen

This step is optional as a simple boot screen with the name of your executable will be created on build. But you must admit, with a beautiful boot picture, the application looks better. So let's create our own.

Let's create a logo file. Let's name it, for example, CustomScreenLogo.png . Place it in the ios folder and add it to the project.

Now you need to build the project, go to the build folder and find the xcodeproj file. In our case, this is places_map.xcodeproj . We right-click on it and go to its contents. Copy the file LaunchScreen.xib to the ios folder of our application and rename it to CustomScreen.xib .

It is important that the extension be xib in the name, and LaunchScreen does not appear in the name.

> It is worth noting that according to information on various sites, Apple is now gradually trying to transfer everyone to the Storyboard. But I still tried to use the xib file option, as suggested in the Qt documentation.

Add the following lines to the *.pro file in the ios section:

    app_launch_screen.files = $$PWD/ios/CustomScreen.xib $$files($$PWD/ios/CustomScreenLogo.png)
    QMAKE_BUNDLE_DATA += app_launch_screen

And in the Info.plist file, in the UILaunchStoryboardName key, we specify CustomScreen (the name of our xib file without extension).

And rebuild the project. And run the xcodeproj file in Xcode.

In the BundleData folder we should now have our added files:

Open the CustomScreen.xib file.

Delete labels Label and places_map. We click on the plus sign in the upper right part and add the Image VIew element to the View section. And on the right side in the Image section, select our CustomScreenLogo.png logo.

Open the Size Inspector tab and specify Autoresizing so that our logo changes size on different devices.

It is also worth changing the background color of the View.

Then we save everything, close Xcode and build the project again in QtCreator.

Health check

Now you can run the project on your iOS device and check if it works.

I will not talk about how to put the project in the AppStore - it is completely ready for uploading like a regular Xcode project, and there are quite a lot of instructions on the net on how to do this. For unloading only, use the Release assembly.

Used materials

Platform Notes - iOS

QMAKE Variable reference

Icon generator

Questions I have left

  • How to check that the user has allowed the use of geolocation and other services? How to request permission while the application is running as needed?
  • One error pops up while building -
    AppIcon.appiconset/[][ipad][76x76][][][1x][][]:-1: error: notice: 76x76@1x app icons only apply to iPad apps targeting releases of iOS prior to 10.0.
    . It can be avoided by writing icons directly in Info.plist, but such writing then prevents the program from being uploaded to the AppStore. In theory, the error does not interfere with anything, but it is annoying. Is there a way to somehow remove it?
  • How can I set the size of the image in the article? And it was painfully big some of the pictures turned out.
We recommend hosting TIMEWEB
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.

Do you like it? Share on social networks!

Алексей Внуков
  • Dec. 26, 2019, 4:17 p.m.

для последнего Xcode и для последних версий iOS нужно брать Qt 5.14.
по поводу виртуалки - все работает нормально но без сборки на живой айфон у меня не получилось получить бинарник который принимает стор.
согласно последним соглашениям в Info.plist дожны быть обязательно указаны поля NSCameraUsageDescription, NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription.
после первого создания Info.plist и вносения в него изменений - рекомендую его бекапить, посколько при каждой сборке он будет перезатираться


Only authorized users can post comments.
Please, Log in or Sign up

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:70points,
  • Rating points1

Qt - Test 001. Signals and slots

  • Result:84points,
  • Rating points4
Last comments
kmssrFeb. 8, 2024, 6:43 p.m.
Qt Linux - Lesson 001. Autorun Qt application under Linux как сделать автозапуск для флэтпака, который не даёт создавать файлы в ~/.config - вот это вопрос ))
Qt WinAPI - Lesson 007. Working with ICMP Ping in Qt Без строки #include <QRegularExpressionValidator> в заголовочном файле не работает валидатор.
EVADec. 25, 2023, 10:30 a.m.
Boost - static linking in CMake project under Windows Ошибка LNK1104 часто возникает, когда компоновщик не может найти или открыть файл библиотеки. В вашем случае, это файл libboost_locale-vc142-mt-gd-x64-1_74.lib из библиотеки Boost для C+…
JonnyJoDec. 25, 2023, 8:38 a.m.
Boost - static linking in CMake project under Windows Сделал всё по-как у вас, но выдаёт ошибку [build] LINK : fatal error LNK1104: не удается открыть файл "libboost_locale-vc142-mt-gd-x64-1_74.lib" Хоть убей, не могу понять в чём дел…
GvozdikDec. 18, 2023, 9:01 p.m.
Qt/C++ - Lesson 056. Connecting the Boost library in Qt for MinGW and MSVC compilers Для решения твой проблемы добавь в файл .pro строчку "LIBS += -lws2_32" она решит проблему , лично мне помогло.
Now discuss on the forum
BlinCTJune 25, 2024, 1 a.m.
Нарисовать кривую в qml Всем привет. Имеется Лист листов с тосками, точки получаны интерполяцией Лагранжа. Вопрос, как этими точками нарисовать кривую? ChartView отпадает сразу, в qt6.7 появился новый элемент…
Evgenii Legotckoi
Evgenii LegotckoiJune 24, 2024, 3:11 p.m.
добавить qlineseries в функции Я тут. Работы оень много. Отправил его в бан.
BlinCTMay 5, 2024, 5:46 a.m.
Написать свой GraphsView Всем привет. В Qt есть давольно старый обьект дял работы с графиками ChartsView и есть в 6.7 новый но очень сырой и со слабым функционалом GraphsView. По этой причине я хочу написать х…
Evgenii Legotckoi
Evgenii LegotckoiMay 2, 2024, 2:07 p.m.
Мобильное приложение на C++Qt и бэкенд к нему на Django Rest Framework Добрый день. По моему мнению - да, но то, что будет касаться вызовов к функционалу Андроида, может создать огромные трудности.
IscanderCheApril 30, 2024, 4:22 a.m.
Во Flask рендер шаблона не передаётся в браузер Доброе утро! Имеется вот такой шаблон: <!doctype html><html> <head> <title>{{ title }}</title> <link rel="stylesheet" href="{{ url_…

Follow us in social networks