Flaky notifications ...

For a while I used the following way of displaying a notification with an AppleScript dragged into the project :

on run {notif, titler} display notification notif with title titler end run

Simple enough, worked every time. Well, that was until El Crapitan. Today in 10.11.5 it sometimes displays, sometimes not. No rule I could find to work around.

So I thought maybe using AppleScript was too simple, and I should employ NSUserNotifications instead. So I went to the faithful MBS Complete collection, and used :

[code] dim u as new NSUserNotificationMBS

u.Title = “Hello World”
u.subtitle = “from Real Studio.”
u.informativeText = “Our first Notification from Real Studio.”

dim d as new date
d.Second = d.Second + 1
u.deliveryDate = d

dim c as new NSUserNotificationCenterMBS
c.scheduleNotification u[/code]

You know what ? Same punishment : sometimes it works, sometimes it won’t !

I verified that I did not have anything preventing notifications display in Preferences like Do Not Disturb.

This is plain annoying.

Will I be forced to mock up notifications with a window like I do on the other side now ? Grrr.

I might be that you need to assign a value to NSUserNotification’s actionButtonTitle or set hasActionButton to false (the default is true).

Tried both to no avail :frowning:

I thought it could be a problem with the latest versions of Xojo. Tried with 2015R2.4, no joy either :frowning:

[quote=267196:@jean-paul devulder]work well with my dtPlugins

dl example here:

extract plugin before use example

if think it’s not a Xojo problem but minor bug on Mbs[/quote]

Thank you Jean-Paul. I am going to try right away.

Have you tried deliver notification instead of schedule? Also I never set a date or time when a notification should up. However by default the application has to be in the background for the notification to show, this can be overridden by using attaching a delegate or I think you can also switch the notification type to alert (in App Wrapper, click the “action” icon next to High Resolution).

Must be something in my project. Jean-Paul example works perfectly in the test project, but once copied into my project it stops working.

Your app needs to be in the background. The MBS notifications work fine for me.

Oups. I had forgotten to initialize z. Now it works perfectly.

Thank you Jean-Paul !
:slight_smile:

Good.