Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Desktop, MacOS, can't makeApplicationDelegate and compile



  • Hello all!
    So, we have a Qt Desktop application that needs to now have PushKit integrated for Voip notifications since Apple is pushing for apps to obey sleep, but it's a video relay app so we need to be able to get incoming calls.
    I've tried just about every combo based on this but for MacOS:
    https://github.com/gympulsr/qt-pushnotifications

    All of them give the same error when building the application.
    So, I stripped it down to the most base form (my mm file), baby steps, but still the same!

    Here is the current code in my mm:

    #include <AppKit/NSApplication.h>
    
    @interface QCocoaApplicationDelegate
    @end
    //add a category to AppDelegate
    @interface QCocoaApplicationDelegate (QPushNotificationDelegate)
    @end
    
    
    @implementation QCocoaApplicationDelegate (QPushNotificationDelegate)
    
    @end
    

    No matter what, I get the following output:

    /Users/<me>/OtherProjects/<our_project>/branches/build-<our_project>_Qt_5_15_1_clang_64bit-Release/pushnotifications.o:-1: error: Undefined symbols for architecture x86_64:
    "OBJC_CLASS$_QCocoaApplicationDelegate", referenced from:
    _OBJC$CATEGORY_QCocoaApplicationDelegate$_QPushNotificationDelegate in pushnotifications.o
    :-1: error: linker command failed with exit code 1 (use -v to see invocation)
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [<our_project>.app/Contents/MacOS/<our_project>] Error 1

    I'm going nuts! Any idea how I can properly use PushKit in a Qt Desktop app? Thanks!


  • Lifetime Qt Champion

    Hi,

    I am currently not sure you can do that easily. The QCocoaApplicationDelegate lives in the Cocoa QPA plugin. That's likely working on iOS because it's currently statically linked which is not the case here.


Log in to reply