I have a C++ file that runs Obj-C stuff also but the Obj-C stuff does not seem to be getting ran (it compiles fine) but I get an error saying that the stuff obj-c is suppose to do (in this case register for growl) did not get ran.
growlwrapper.mm
#import "growlwrapper.h"
@implementation GrowlWrapper
- (NSDictionary *) registrationDictionaryForGrowl {
return [NSDictionary dictionaryWithObjectsAndKeys:
[NSArray arrayWithObject:@"Upload"], GROWL_NOTIFICATIONS_ALL,
[NSArray arrayWithObject:@"Upload"], GROWL_NOTIFICATIONS_DEFAULT
, nil];
}
@end
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: YES
clickContext: nil
];
[pool drain];
}
int main() {
showGrowlMessage("Hello World!", "This is a test of the growl system");
return 0;
}
growlwrapper.h
#ifndef growlwrapper_h
#define growlwrapper_h
#include <string>
#include <iostream>
#include <Cocoa/Cocoa.h>
#include <Growl/Growl.h>
using namespace std;
void showGrowlMessage(std::string title, std::string desc);
int main();
#endif
@interface GrowlWrapper : NSObject <GrowlApplicationBridgeDelegate>
@end
Any idea why it is not being ran?
You are setting your growl delegate to an empty string instead of an instance of your GrowlWrapper
class.