This guide explains how to integrate OneSignal with a Xcode project crated with Qt technology.
OneSignal is a very useful platform used to manage push notifications in iOS and Android. The integration is very easy if you are working with native project, but it becomes more difficult using Qt, in particular for iOS platform that requires some tricks to make it works.

Adding the target Notification Service Extension

The first big problem is regarding the Notification Service Extension, a target that must be added in your project in order to manage notifications in iOS.
For this reason, the integration of OneSignal requires this target too. In order to add the Notification Service Extension in your project you have to follow these steps: New -> Add Target - Notification Service Extension.

The target is created inheriting the configuration of the main project and it leads to an issue during the compiling of the project. The issue is due to a specific flag that comes from the main project created by Qt.

To fix this problem remove the flag -Wl,-e,_qt_main_wrapper from the Other Linker Flags in the Build Settings of the Notification Service Extension target.
Now the project can be built successfully.

Integration of OneSignal without CocoaPods

If you are not familiar with CocoaPods, we can simply say that it's a dependency manager for Swift and Objective-C Cocoa projects.
OneSignal provides a very easy way to integrate their framework in a Xcode project using a simple pod installation.

Everything works perfectly if you make the integration with a native project, but with a Qt project the integration doesn't work and creates many issues.

The solution is very easy and can be done by manually integrating the OneSignal framework.

If you don't have the framework yet, you can get it by creating a temporary Xcode project and installing it with the simple steps that you can find in OneSignal guide.

Take the framework and get rid of the temporary project.

Now that you have the framework you need to add it manually. In Notification Service Extension target 2 frameworks are required: OneSignal and SystemConfiguration.
In the main project you need to add 4 frameworks: OneSignal, SystemConfiguration, UserNotifications and UserNotificationsUI.

It's done. You can run your project using OneSignal.

Be sure that the project is correctly configured to manage push notifications (capabilities and certificates).
And don't forget to add all the necessary code specified in OneSignal guide, in particular in the Notification Service Extension.


This guide is written using Qt 5.12 with Xcode 10.2.
With the previous versions of Qt and Xcode, the integration of OneSignal was much easier, because there were no extensions to add in the native project and the installation using CocoaPods ran correctly.

Now, as you can see, the integration is pretty tricky and the only solution that I found is this.
I hope that with newer versions of both platforms these kind of problems will be fixed or, at least, better managed by Qt.