growlNotificationWasClicked: not getting called as expected

81 views
Skip to first unread message

Chris Rivers

unread,
Dec 14, 2012, 8:08:20 PM12/14/12
to growl-de...@googlegroups.com
My problem:

I'm trying to send growl notifications that can be clicked on in order to focus on the source of the notification in my app. The growlNotificationWasClicked: message never gets sent to my delegate, even though I notify with a non-nil clickContext.

Details:

My app registers with Growl via the .growlRegDict plist method. The contents of the file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>AllNotifications</key>
        <array>
                <string>MessageNotification</string>
        </array>
        <key>DefaultNotifications</key>
        <array>
                <string>MessageNotification</string>
        </array>
        <key>TicketVersion</key>
        <integer>1</integer>
</dict>
</plist>

In my application's applicationDidFinishLaunching: function, I have the following code: 

[GrowlApplicationBridge setGrowlDelegate:(id <GrowlApplicationBridgeDelegate>)self];

In my AppDelegate file, I've declared a delegate function:

- (void)growlNotificationWasClicked:(id)clickContext {
    NSLog(@"GOT GROWL NOTIF CLICK: %@", clickContext);
}

At some point in my app, I'm calling (with a non-nil context of type NSDictionary):

[GrowlApplicationBridge notifyWithTitle:title
                            description:body
                       notificationName:@"MessageNotification"
                               iconData:nil
                               priority:0
                               isSticky:NO
                           clickContext:context];

This displays a Growl notification as expected. However, when I click on the notification, my AppDelegate's growlNotificationWasClicked: method doesn't get called. As far as I can tell, there are no other settings required to handle clicks on notifications. Is there something that I'm missing?

Chris Rivers

unread,
Dec 17, 2012, 2:02:09 PM12/17/12
to growl-de...@googlegroups.com
Answering my own question after some extended debugging time...

The issue was that I was sending a non-compatible value in the NSDictionary I was using for my clickContext. Changing all the objects in the dictionary to be a pList compatible type (NSDictionaryNSArrayNSStringNSDateNSData, or NSNumber) made everything work. The strange part is that when forwarding to Notification Center (as happens if Growl isn't installed or running), the incompatible types caused a crash trying to display the notification. When I was actually running Growl, there was no crash, but clicking on the notification did nothing.

Christopher Forsythe

unread,
Dec 17, 2012, 2:22:03 PM12/17/12
to growl-de...@googlegroups.com
Maybe we can document this so that others do not run into it as easily. Where would you have looked for help on this?
-- 
Chris Forsythe

--
You received this message because you are subscribed to the Google Groups "Growl Development" group.
To view this discussion on the web visit https://groups.google.com/d/msg/growl-development/-/IiSJWaJX7VQJ.
To post to this group, send email to growl-de...@googlegroups.com.
To unsubscribe from this group, send email to growl-developm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/growl-development?hl=en.

Chris Rivers

unread,
Dec 17, 2012, 3:29:08 PM12/17/12
to growl-de...@googlegroups.com
I originally was trying to find the answer in both the online documentation (http://growl.info/documentation/developer/implementing-growl.php#notification) and in the headers for the framework. Technically, the answer is there... there is a line that says:
clickContext must be a property list: it must be a dictionary, array, string, data, or number object. Not all displays support click feedback.
However, it's a little misleading - instead of saying "it must be a..." it should probably say "it must only contain valid property list objects:" and perhaps have a link to the property list documentation on Apple's developer pages (https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html)

Chris

Rudy

unread,
Dec 18, 2012, 12:23:31 AM12/18/12
to growl-de...@googlegroups.com
the clicking of the notification having no effect is a known issue that we haven't fully solved, but is slated for a release after 2.1.

-rudy

Nicholas Riley

unread,
Aug 7, 2013, 7:00:12 PM8/7/13
to growl-de...@googlegroups.com
Is there a way to determine whether the current version of Growl will send growlNotificationWasClicked:?  

Several people have reported bugs in my app which I tracked down to this problem; the app works fine with Growl 1.2.2 but never receives either the clicked or timed out notification with 2.1.  I can work around it by not bothering to wait for a Growl notification that will never come, if I can identify which versions of Growl are broken.

Thanks!

Christopher Forsythe

unread,
Aug 7, 2013, 8:41:23 PM8/7/13
to growl-de...@googlegroups.com
I'll be publishing the SDK this week to help address this issue. The problem is that sandboxing basically broke how notification clicking worked for us in 1.2.2, so we had to try a different solution. We've come up with a pretty decent one in 2.1 with the 3.0 sdk being released this week. Let's see if that helps here.

Chris

To unsubscribe from this group and stop receiving emails from it, send an email to growl-developm...@googlegroups.com.

To post to this group, send email to growl-de...@googlegroups.com.



--
Chris Forsythe

Nicholas Riley

unread,
Aug 11, 2013, 10:54:37 AM8/11/13
to growl-de...@googlegroups.com
Sounds good, thanks. It'd be ideal if Growl either reliably notified you that a notification was clicked/finished/timed out, or indicated that this wasn't supported (because the notification is disabled, or the display style doesn't support it, or…)

For the moment I am just checking the Growl version number and not expecting callbacks in 2.0 or later.

Chris Forsythe

unread,
Aug 11, 2013, 3:06:50 PM8/11/13
to growl-de...@googlegroups.com
We had something come up which might hold up the sdk temporarily that needs to be checked out. If you would like I can provide you with a beta sdk though to see if it provides you with some additional help here. Email me if you are interested, ch...@growl.info

-- 
Chris Forsythe
Reply all
Reply to author
Forward
0 new messages