Simple example project?

The Growl forums have moved to Google Groups, this forum is read only.
Locked
CompiledMonkey
Harmless
Posts: 5
Joined: Tue Nov 07, 2006 6:11 am
Location: Richmond, VA
Contact:

Simple example project?

Post by CompiledMonkey »

Is there a simple example out there on how to use growl? I'm not getting anywhere with the current docs.
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

The BeepHammer project in the Developer Tools folder of the source is a pretty straightforward usage example.
The duck still burns.
--
My company: Saltatory Software. Check it out :)
CompiledMonkey
Harmless
Posts: 5
Joined: Tue Nov 07, 2006 6:11 am
Location: Richmond, VA
Contact:

Post by CompiledMonkey »

&OK, here's what I have currently. The error I'm getting at run time is: "*** Uncaught exception: <NSInvalidArgumentException> *** +[GrowlApplicationBridge notifyWithTitle:description:notificationName:]: selector not recognized". Any idea what I'm doing wrong?

GrowlController.h

Code: Select all

#import <Cocoa/Cocoa.h>
#import <Growl-WithInstaller/Growl.h>

@interface GrowlController: NSObject<GrowlApplicationBridgeDelegate>
{
	
}

@end
GrowlController.m

Code: Select all

#import "GrowlController.h"

#define SampleNotificationName  @"The HelloGrowl Sample Notification"
#define GROWL_NOTIFICATION_DEFAULT @"NotificationDefault;

@implementation GrowlController

- (void) awakeFromNib {
	[GrowlApplicationBridge setGrowlDelegate:self];
	//[GrowlApplicationBridge reregisterGrowlNotifications];
	
	//NSDictionary *prefsDict = [[NSDictionary alloc] initWithContentsOfFile:GROWL_PREFS_PATH];
	//[growlLoggingButton setState:[[prefsDict valueForKey:@"GrowlLoggingEnabled"] intValue]];
}

- (NSString *)applicationNameForGrowl {
	return @"BeepHammer";
}

- (NSDictionary *) registrationDictionaryForGrowl
{
    NSArray *notifications = [NSArray arrayWithObjects:
            SampleNotificationName,
            nil];
	
    NSDictionary *regDict = [NSDictionary dictionaryWithObjectsAndKeys:
            @"Weather", GROWL_APP_NAME,
            notifications, GROWL_NOTIFICATIONS_ALL,
            notifications, GROWL_NOTIFICATIONS_DEFAULT,
            nil];
	
    return regDict;
}

- (void) sendMessage {
	[GrowlApplicationBridge notifyWithTitle:"Title"
                                description:"Description"
                           notificationName:SampleNotificationName];
}

@end
main.m

Code: Select all

#import <Cocoa/Cocoa.h>
#import "GrowlController.h"

int main(int argc, char *argv[])
{
	GrowlController *cont = [[GrowlController alloc] init];
	[cont sendMessage];
	
    return NSApplicationMain(argc,  (const char **) argv);
}
Locked