我正在为 Growl 1.3.1 SDK 开发一个小型包装器。更具体地说,我想将 Growl 打包到我的应用程序中,这样即使用户没有 Growl,他们仍然能够收到通知。我之前安装了 Growl,我的代码会触发通知。我已经卸载了 Growl 并且只使用了框架;雾,我相信它被称为。但是,当我现在启动代码(Growl 已卸载)时,不会触发任何通知!以下是我目前正在使用的代码:
#import "growlwrapper.h"
void showGrowlMessage(std::string title, std::string desc) {
std::cout << "[Growl] showGrowlMessage() called." << std::endl;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[GrowlApplicationBridge setGrowlDelegate: @""];
[GrowlApplicationBridge
notifyWithTitle: [NSString stringWithUTF8String:title.c_str()]
description: [NSString stringWithUTF8String:desc.c_str()]
notificationName: @"Upload"
iconData: nil
priority: 0
isSticky: NO
clickContext: nil
];
[pool drain];
}
int main() {
showGrowlMessage("Hello World!", "This is a test of the growl system");
return 0;
}
我也有适当的 Growl Registration 字典,并且正在编译:
g++ growlwrapper.mm -framework Growl -framework Foundation -o growltest
这段代码有什么问题吗?任何想法为什么它不会被解雇?
编辑:似乎上面的代码工作得很好。只需要在运行循环中使用适当的 Growl 字典即可。