Qt QGuiApplication 或 QApplication 导致“No NSMainNibFile ..”错误

qdo*_*dot 5 c++ macos qt objective-c osx-yosemite

我正在使用 Qt 库为 OSX 10.10 构建应用程序扩展。

最终,我需要实例化QApplication以创建QWidget派生类。该软件按预期运行,只要它是用以下内容构建的:

int main(int argc, char *argv[]) {
    QCoreApplication a(argc, argv);
    NSLog(CFSTR("Invoking Main"));
    __asm__ ("call _NSExtensionMain");
}
Run Code Online (Sandbox Code Playgroud)

构建它

int main(int argc, char *argv[]) {
    QGuiApplication a(argc, argv);
    NSLog(CFSTR("Invoking Main"));
    __asm__ ("call _NSExtensionMain");
}
Run Code Online (Sandbox Code Playgroud)

在运行时导致以下错误:

24/10/2014 14:40:08.091 My_ShellExt[32427]: Invoking Main  
24/10/2014 14:40:08.092 My_ShellExt[32427]: No NSMainNibFile or NSMainStoryboardFile specified in info dictionary, exiting
24/10/2014 14:40:08.095 com.apple.xpc.launchd[1]: (me.qdot.My_Daemon.My_ShellExt[32427]) Service exited with abnormal code: 1
Run Code Online (Sandbox Code Playgroud)