inessential by Brent Simmons

January 2021

URLSession’s Delegate Queue Should Be the Main Queue

Consider this line of code from RSWeb, a framework NetNewsWire uses:

urlSession = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: OperationQueue.main)

The delegateQueue parameter specifies the queue for all delegate callbacks from URLSession — and here I’ve just gone and made it the main queue.

Some of you are screaming. I can hear you: “Brent, Brent, Brent — you’re going to block the main thread! Don’t do it!”

Let’s Back Up and Review the Documentation

The documentation says of the delegateQueue parameter that it’s…

An operation queue for scheduling the delegate calls and completion handlers. The queue should be a serial queue, in order to ensure the correct ordering of callbacks.

(Pause right here and go check your own code to make sure you’re actually using serial queues. There’s a good chance you’re not.)

Given that the delegate callbacks should be on a serial queue, those callbacks should return as quickly as possible so that they don’t block subsequent calls.

You may have some expensive things to do — NetNewsWire, for instance, does RSS parsing and database updating. Those things should be done on separate serial queues — they should not be done on the delegate callback thread, because you don’t want to block it.

In other words, this all means that your delegate methods should be so fast that they wouldn’t block the main thread.

So Just Use the Main Thread

Your code that uses URLSession almost certainly has some data structures that do things like map a task identifier to some model object of some kind. You could go to lengths to make sure this is all thread-safe — and hope and pray nobody messes it up six months from now — or you could take the easy, safe route and go main-thread-only with that code.

That’s what we do with NetNewsWire. (And did with Vesper and other apps.)

It’s important to know I’m a performance junkie and a stability junkie — and with this practice I satisfy both.

iOS Jobs at Audible

We could be co-workers! I love working at Audible, and I think you would too. Plus — no small thing — you’d be working on an app that means so much to millions of people.

Scroll down on this page to find a list of jobs (plus a link to a longer list). On the iOS team we have several engineering positions, a QA engineering position, and a software developer manager position.

New Domain for NetNewsWire

I was not foresighted enough, back in the early 2000s, to register the netnewswire.com domain — and so, of course, somebody else bought it with the hopes of selling it to me.

(These days the first thing you do is register the domain name. But that wasn’t as much a thing back then.)

I’ve been long resigned to never own that domain name. But then, just a few days before Christmas, I got an email from Ben Ubois, founder and developer of Feedbin, saying that he’d bought it for me. We transferred the domain pretty quickly after.

And then, this weekend, I got the new site set up — and now you can find NetNewsWire where it always should have been: netnewswire.com.

Thanks to Ben!

Early Test Build: NetNewsWire 6.0d4 for Mac

The app is made of cat’s claws and fury. I try my damnedest to warn you off:

You should probably skip it. It’s not a beta. It’s not even an alpha. It’s a d release — where d, which used to stand for development, now stands for dangerous.

…and…

…let us satisfy your curiosity in advance: it’s just an app. It’s got some more features. You know the story, and you don’t need to run this if you’re just curious.

With that out of the way: the team has been doing great work! This is the first build with a Big Sur UI and app icon. It’s universal (Intel and Apple Silicon). It adds syncing via iCloud, Inoreader, NewsBlur, and others. It has special support for Twitter and Reddit feeds. Etc.

But I really do mean it when I say it’s early and dangerous. I’d like your help testing, but I need you to know it could be quite rocky and we may not have time to help you. You could lose data. You’d be doing a favor for the team which we have no way to repay — other than by eventually releasing the best app we can.

I’ve been haunted since hearing, in the early days of the pandemic, that if we all wore masks for six weeks this thing would be over.

I was there. I’ve done that for six weeks, and another six weeks, and another. And now it’s worse than ever. It’s a challenge not to be angry.

There are healthy, uninfected people right now, today, who are excited for the vaccine and who will die before they get it.

Bogus Code Signing Crash

For a few people, NetNewsWire for Mac crashes on startup — and the crash log erroneously blames an invalid code signature.

If it were truly invalid, the app wouldn’t launch for anybody. But it launches fine for almost everybody.

This started with macOS 10.15.4 and continues in macOS 11. We’ve posted more details on our issue tracker at GitHub.

Does anybody have any ideas for how to work around this?