My notification banners (using MBS) work everywhere except Big Sur

I use MBS plugins, with Xojo, to access the Notification Center on Mac. I have had no problems for years. Starting somewhere in the course of Big Sur betas, though, I have been getting sketchier performance. The notifications get delivered. However, while I’ve set things so that the banners will display when the app is in front, I only get this sporadically.

Okay, I thought–NSNotifications were deprecated in Mojave, so let’s jump in to UNNotifications. Again, Christian has the plugins ready and waiting. No example project, though–maybe I’ll be the one to write it . :slight_smile:

What I came up with works perfectly in Mojave and Catalina. Indeed, I added this to a “real” project, falling back to the old API when running on <Mojave. That works too.

Once again, though, on BS the notification delivers but does not display unless the app is in the background. While the old API was inconsistent, now it’s “never”.

UNNotification Example is here. This archive has the sample project, along with my build.

I learned that, unlike before, UNUserNotificationCenter will reject anything from an unsigned app, so running the project in the debugger will require an appropriate build script. The compiled app, included for reference, is notarized–and of course registers the MBS plugins too.

I wonder what I might be missing. There is, of course, an elephant in the room: this could be a Big Sur issue. I did put in a feedback case with an earlier version of the example app. If that can be confirmed, I can relax and let Apple sort it out :slight_smile:

Thank you for reading.

I wonder if Xojo will need to do some kind of temporary signing cert for apps no on macOS ?

Even Xcode 12 seems to be doing this when you run a project there

Well, Sam and AppWrapper made it easy for me. :slight_smile:

1 Like

Speaking of Sam, I corresponded some with him on this matter. Foregoing UNNotifications for the moment, I made a copy of a project, still on NSNotifications, and converted it from using MBS to OW App Kit. But I got the identical behavior on Big Sur as what started all this :stuck_out_tongue:

1 Like

In early 2019, I designed the Blackbird code signing engine, so that it would be quick enough and comprehensive enough to use when debugging. Basically this purpose. App Wrapper is built around this principle, so that your debug applications are code signed exactly like a built application. but when running your application in the IDE.

1 Like

Future Jerry: Well, it appears I figured out what was going on in my projects (only with BS) with my NSNotifications. Again, the issue was never with whether they were delivered, but rather with whether they were displayed.

That takes a little urgency off of figuring out UNNotifications on Big Sur, but it is still the long term goal. :slight_smile:

You got NSNotifications to work in BS when the app is in the foreground?

Yes. You’ll see an email from me, as we’ve been discussing this in the context of OW AppKit.
On BS I now have consistent (rather than intermittent) display of my notifications. As I say in the email, I only half-understand my fix, after trying to figure out what was different in the ones that DID work.

First, my cross-platform notification code is in a module. Most notifications are triggered in Thread.UserInterfaceUpdate events. I did two things.

First, in the event handler code, I made sure to call the notification method at the end, after the other stuff of resetting menus, enabling/disabling controls, etc. Previously it might have been first, or even in the middle.

Second, the notifications of most concern were at the end of lengthy CURL operations. These threads are run in little windows of their own with progress bars, etc. The thread gave the notification at the end (info based on the CURL error code), then the window immediately closed. I added a timer to keep the window open a fraction longer, arbitrarily choosing 300ms. And I will be darned if that didn’t fix it.

Again, only jumping through these hoops on Big Sur. I have every VM back to Yosemite and my code had worked on every one! And I’m glad this doesn’t break anything there.

I would click “solution” on this thread–but after all, it’s about UNNotifications, not NS. Again, what I have there also works perfectly on Mojave and Catalina :stuck_out_tongue:

1 Like

Future Jerry: Today’s BS beta made a world of difference. :slight_smile:

1 Like