Nominate our 2022 Qt Champions!

Use Firebase SDK on iOs (push notifications)

  • Hi,

    has someone of you successfully used the Firebase SDK for integrating push notifications? I mostly followed this guide here:

    The relevant parts are looking like this:

    my AppDelegate:

    #import "FirebaseInstanceID.h"
    #import "FirebaseMessaging.h"
    #import "FirebaseAnalytics.h"
    #import <FIRApp.h>
    @interface QIOSApplicationDelegate
    //add a category to QIOSApplicationDelegate
    @interface QIOSApplicationDelegate (QPushNotificationDelegate)
    (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Register for remote notifications. This shows a permission dialog on first run, to
            // show the dialog at a more appropriate time move this registration accordingly.
            if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
                // iOS 7.1 or earlier. Disable the deprecation warnings.
    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wdeprecated-declarations"
                UIRemoteNotificationType allNotificationTypes =
                (UIRemoteNotificationTypeSound |
                 UIRemoteNotificationTypeAlert |
                [application registerForRemoteNotificationTypes:allNotificationTypes];
    #pragma clang diagnostic pop
            } else {
                // iOS 8 or later
                // [START register_for_notifications]
                if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {
                    UIUserNotificationType allNotificationTypes =
                    (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
                    UIUserNotificationSettings *settings =
                    [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
                    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
                // [END register_for_notifications]
    // [START configure_firebase]
        [FIRApp configure];
        // [END configure_firebase]
        // Add observer for InstanceID token refresh callback.
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tokenRefreshNotification:)
                                                     name:kFIRInstanceIDTokenRefreshNotification object:nil];

    my *.pro file:

    MAKE_LFLAGS += -F$$PWD/ext/libraries/ios/Firebase/Analytics
        QMAKE_LFLAGS += -F$$PWD/ext/libraries/ios/Firebase/Messaging
        QMAKE_LFLAGS += -ObjC
        INCLUDEPATH += $$PWD/ext/libraries/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers
        INCLUDEPATH += $$PWD/ext/libraries/ios/Firebase/Analytics/FirebaseInstanceID.framework/Headers
        INCLUDEPATH += $$PWD/ext/libraries/ios/Firebase/Messaging/FirebaseMessaging.framework/Headers
        INCLUDEPATH += $$PWD/ext/libraries/ios/Firebase/Analytics/FirebaseCore.framework/Headers
        LIBS +=-framework FirebaseAnalytics
        LIBS +=-framework FirebaseCore
        LIBS +=-framework FirebaseInstanceID
        LIBS +=-framework GoogleInterchangeUtilities
        LIBS +=-framework GoogleSymbolUtilities
        LIBS +=-framework GoogleUtilities
        LIBS +=-framework FirebaseMessaging
        LIBS +=-framework GoogleIPhoneUtilities
        LIBS +=-framework AddressBook
        LIBS += -lsqlite3

    Unfortunately I always get:

    Use of undeclared identifier FIRApp

    when compiling. Does anyone have an idea on how to fix that?

  • Hi!

    V-Play Engine offers several plugins for integrating push notifications in your Qt app, for example with the Google Cloud Messaging service.
    A Firebase plugin is currently being implemented and will be coming soon as well.


  • Here is my solution:
    Create a directory "ios/CocoaPods" inside root path of the Qt Project
    Create inside this directory an Xcode project "Empty" (just autogenerate a single view iOS project with Xcode and save here)
    Create a file "Podfile" with the following content:
    target 'Empty' do
    pod 'Firebase/Core'
    pod 'Firebase/Auth'
    pod 'Firebase/Messaging'
    pod 'Firebase/Database'
    pod 'Firebase/Crash'

    Run "pod install"; and inside the "CocoaPods" there will be a directory "Pods" with generated Frameworks.
    In your .pro add the following lines to include frameworks:
    LIBS += -F$$PWD/ios/CocoaPods/Pods/FirebaseCore/Frameworks -framework FirebaseCore \
    -F$$PWD/ios/CocoaPods/Pods/FirebaseAnalytics/Frameworks -framework FirebaseAnalytics \
    -F$$PWD/ios/CocoaPods/Pods/FirebaseAuth/Frameworks -framework FirebaseAuth \
    -F$$PWD/ios/CocoaPods/Pods/FirebaseCrash/Frameworks -framework FirebaseCrash \
    -F$$PWD/ios/CocoaPods/Pods/FirebaseDatabase/Frameworks -framework FirebaseDatabase \
    -F$$PWD/ios/CocoaPods/Pods/FirebaseInstanceID/Frameworks -framework FirebaseInstanceID \
    -F$$PWD/ios/CocoaPods/Pods/FirebaseMessaging/Frameworks -framework FirebaseMessaging

    INCLUDEPATH += $$PWD/ios/CocoaPods/Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers \
    $$PWD/ios/CocoaPods/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers \
    $$PWD/ios/CocoaPods/Pods/FirebaseAuth/Frameworks/FirebaseAuth.framework/Headers \
    $$PWD/ios/CocoaPods/Pods/FirebaseCrash/Frameworks/FirebaseCrash.framework/Headers \
    $$PWD/ios/CocoaPods/Pods/FirebaseDatabase/Frameworks/FirebaseDatabase.framework/Headers \
    $$PWD/ios/CocoaPods/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers \
    XCODE_EXTRAS.files = ios/GoogleService-Info.plist

  • The Zetpush is an option for push notifications.

  • Hi there,

    I am currently contributing QtCloudMessaging API wrapper to Qt. Its helping developers to use push notification services in easy way. There are two services integrated: Firebase and Kaltiot embedded backends. Those two also gives example how one can extend new services behind the wrapper.

    Repository is currently under preview, but has gone through multiple review rounds already and is functional. To get started do following:

    1. Clone repo
      git clone

    2. Get latest patch:
      git fetch refs/changes/55/202155/28 && git checkout FETCH_HEAD

    3. Install and compile repo to your platform. Check readme instructions.
      qmake CONFIG+="firebase"
      make install

    4. Check example app for Firebase (detailed instructions in readme there) and embedded devices from:

    4.1 The pod file install for firebase needs few tweaks for Qt-generated xcode project file, but with following commands (or added in .sh file) you can easily tweak it. Run these with terminal inside .xcodeproj folder (right click + Show Package Contents):
    sed -i '' '/refType = 0;/d' ./project.pbxproj
    sed -i '' '/name = "Compile Sources";/d' ./project.pbxproj
    sed -i '' '/name = "Link Binary With Libraries";/d' ./project.pbxproj
    sed -i '' '/name = "Copy Bundle Resources";/d' ./project.pbxproj
    sed -i '' '/buildRules = (/ { N; d; }' ./project.pbxproj*

    Tell me if you encounter any problems.

  • @SnowGrains I saw this mentioned in the blog (, but the URL for cloning is invalid, even just two weeks after that blog post. What happened?

Log in to reply