w0lfschild/NotificationClear

Workaround issue on 10.9 with Calendar App

Closed this issue · 3 comments

Change the objc_msgSend to the following:

       if (appInfo != nil)
        {
            objc_msgSend(data, @selector(clearNotificationsForApplication:), appInfo);
        }

To prevent an issue in 10.9 where the Calendar app creates persistent notifications for the next day's events that cannot be cleared. Otherwise you get NotificationCenter[1173]: -[NCNotificationCenter clearNotificationsForApplication:]: Cannot be called with nil.

This tweak doesn't use the line

objc_msgSend(data, @selector(clearNotificationsForApplication:), appInfo);

Do you mean this?

[data performSelector:@selector(clearNotificationsForApplication:) withObject:appInfo];

Yea probably - I based the change on an older fork. In the newer revision there are two or three places where clearApp and clearNotificationsForApplication are called. In all those places the != nill check should probably be performed.

Pushed out 0.2.4 with the suggested change.