Search code examples
xcodecocoaxcode4.2growl

Is there a way to use GrowlApplicationBridge without NSClassFromString?


I'm trying to build a basic cocoa app that uses Growl.

Every time I want to use GrowlApplicationBridge I have to use something like

Class GAB = NSClassFromString(@"GrowlApplicationBridge");
[GAB performSelector:@selector(setGrowlDelegate:) withObject:self];

I would like to be able to just use

[GrowlApplicationBridge setGrowlDelegate:self];

Here's the compiler error that I get when I try the behavior that I want:

Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_GrowlApplicationBridge", referenced from: objc-class-ref in StatusMenuAppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)


Solution

  • As long as you're importing <Growl/Growl.h> at the top of that file and linking the framework into your app, you should be able to use [GrowlApplicationBridge setGrowlDelegate:self] just fine.

    Check the top of the file and make sure you're importing it, and check your target's “Link Libraries and Frameworks” build phase and make sure you're linking it.