Problem displaying growl notifications when using -fobjc-gc

The Growl forums have moved to Google Groups, this forum is read only.
Locked
deviator
Harmless
Posts: 5
Joined: Sat Dec 22, 2007 2:59 am

Problem displaying growl notifications when using -fobjc-gc

Post by deviator »

Hey Folks,
looking through the forums I found that there was a previous post about linking against a growl.framework that had been compiled with -fobjc-gc. viewtopic.php?t=15353&highlight=fobjcgc
(sorry for not linking, this is my first post)


Whilst following that (used the available 1.1 source from the website) I managed to get my app to recognise the growl.framework and start properly.

I have hit a hiccup in that though the app is being registered with growl, there are no notifications being sent. I have setup a delegate class that returns an NSDictioinary with the notification names, though even inside the System Preferences pane, the notifications aren't displayed there. Is this a known bug with growl or is there something that I'm forgetting to do.

Thanks.
deviator
Harmless
Posts: 5
Joined: Sat Dec 22, 2007 2:59 am

Post by deviator »

Any suggestions on fixing this?

Anyone?

Beuller?
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

Could you post a sample project which makes use of Growl compiled as you described with garbage collecting?
The duck still burns.
--
My company: Saltatory Software. Check it out :)
deviator
Harmless
Posts: 5
Joined: Sat Dec 22, 2007 2:59 am

Post by deviator »

The file is located at: http://reformedsoftware.com/foobar/foobar.zip

Thanks,
Matt.
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

Growl with garbage collecting enabled works fine.

Use the constants listed in GrowlDefines.h rather than making up your own and you'll be fine :)

GROWL_NOTIFICATIONS_DEFAULT not @"GROWL_NOTIFICATIONS_DEFAULT"
GROWL_NOTIFICATIONS_ALL not @"GROWL_NOTIFICATIONS_ALL"

GROWL_NOTIFICATIONS_DEFAULT, for example, is defined as @"DefaultNotifications". You should use the constant in your code.
The duck still burns.
--
My company: Saltatory Software. Check it out :)
deviator
Harmless
Posts: 5
Joined: Sat Dec 22, 2007 2:59 am

Post by deviator »

Thanks for your help. As I'm new to Cocoa dev work, I thought the constants were defined as strings rather than anything else.

As I'm about to head out for a ride I will let you know how everything goes when I get down to coding.

Thanks,
Matt
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

No problem. When a constant is defined, it will automatically be replaced at compile-time by whatever it 'really' is; for example, the compiler will replace GROWL_NOTIFICATIONS_DEFAULT with @"DefaultNotifications". Using the former is better because it is forced to be the same everywhere (preventing typos) and will automatically be updated if it is changed in the header file.

You may want to read http://www.stepwise.com/Articles/Techni ... 11.01.html to learn about memory management - I noticed several memory leaks in your sample code. I wasn't going to say anything since it was just a sample project, but if you're new to Cocoa they may not have been noticed.
The duck still burns.
--
My company: Saltatory Software. Check it out :)
deviator
Harmless
Posts: 5
Joined: Sat Dec 22, 2007 2:59 am

Post by deviator »

Everything works fine now. Many thanks for your help and support.

Having a strong developer community that helps others out is something I really appreciate.

Thanks,
Matt.
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

Oh, hah, I just realized that we were talking about garbage collection - so the memory management mistakes actually don't cause any leaks for your particular code. Still, better not to use copy where it's not needed :)
The duck still burns.
--
My company: Saltatory Software. Check it out :)
Locked