Important: Please read the Qt Code of Conduct -

[SOLVED] How to extend QIOSApplicationDelegate with category on ios?

  • Hi!

    I have qt application for iOS and trying to add functions to application delegate. Guys on "this link": suggest to use categories to extend QIOSApplicationDelegate with own functionality.
    Like this:

    @#import "QIOSApplicationDelegate+OmiAppDelegate.h"
    #import <FacebookSDK/FacebookSDK.h>

    @implementation QIOSApplicationDelegate (OmiAppDelegate)

    • (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
      return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];


    But when I write own category I'm getting error that QIOSApplicationDelegate is unknown.
    What header or plugin should I include to make it known? (I searched for "qiosapplicationdelegate.h" on hard drive but didn't find it).


  • Lifetime Qt Champion


    QIOSApplicationDelegate is in qtbase/src/plugins/platforms/ios

  • [quote author="SGaist" date="1410897385"]Hi,

    QIOSApplicationDelegate is in qtbase/src/plugins/platforms/ios[/quote]

    Thank you, I just copied this and one more header to the project and it works :)

  • Lifetime Qt Champion

    Beware that's pretty dangerous, next iteration of Qt might have this header changed so you might end up with an "invalid" delegate

  • Sure, I understand, thank you!

  • Lifetime Qt Champion

    You're welcome !

    Since you have your delegate working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

  • If somehow has the same problem. It sufficies to add this code instead of copying/including the private header:

    @interface QIOSApplicationDelegate

  • Complete Code:

    In the .pro:

        ios {
            OBJECTIVE_SOURCES = ios/

    In ios/

    #import "UIKit/UIKit.h"
    @interface QIOSApplicationDelegate
    @interface QIOSApplicationDelegate (WoboqApplicationDelegate)
    @implementation QIOSApplicationDelegate (WoboqApplicationDelegate)
    - (BOOL)application:(UIApplication *)application
        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        return YES;

Log in to reply