arturberkovics.comEst. 2026

Engineering Notes

From building ClamNotes alone: what broke, and how I fixed it.

Swift Concurrency

The assumeIsolated crash in a BGTask expirationHandler, and why Swift 6 didn't warn

iOS calls a background task's expiration handler on a queue of its own, not the one you registered. One MainActor.assumeIsolated in that closure took down a TestFlight build, and the compiler had nothing to say about it.

Two crash reports came back from TestFlight build 0.7 (10) of ClamNotes ten minutes apart, from an iPhone 15 Pro Max and an iPad Pro. Same exception on both: EXC_BREAKPOINT (SIGTRAP), crashed thread at _dispatch_assert_queue_fail, one frame above it MainActor.assumeIsolated, and above that a closure I had written as the expiration handler of a background task. If you got here by searching for Incorrect actor executor assumption, it's the same bug under a different signature; I'll show where each one comes from.

This post is the whole story: what the crash report says, why assumeIsolated traps instead of quietly doing the right thing, why neither the Swift 5 nor the Swift 6 language mode warned me, the fix that shipped in 0.7 (11) the same night, and how I reproduced it in the Simulator, where background tasks don't exist.

Continue reading: The assumeIsolated crash in a BGTask expirationHandler, and why Swift 6 didn't warn

Core ML

My Core ML model crash-looped an iPhone 11: the Neural Engine's first-load memory spike

Planning a speech model for the Neural Engine took my app from 48 MB to its memory limit in ten seconds. Jetsam killed it, the next launch tried again, and no crash report ever said why.

On 13 October my iPhone 11, the oldest and smallest iPhone my app runs on, could not get past the app's introduction. The app opened, showed its first screen, and about ten seconds later it was gone. Open it again: same thing. With the console attached, the only…

Continue reading: My Core ML model crash-looped an iPhone 11: the Neural Engine's first-load memory spike

iOS Security

App Attest on Cloudflare Workers: Hide Your LLM API Key

Any key you ship in an app belongs to whoever unzips it. Here is the relay I put between my iPhone app and the AI provider: what Apple's App Attest proves, how the Worker checks it step by step, and what it still can't stop.

For the first week of ClamNotes, an OpenRouter key was compiled into the app's development builds. That was fine while the only copies were the ones I installed from Xcode. It came out in the same change that prepared the first TestFlight build, because a TestFlight build is…

Continue reading: App Attest on Cloudflare Workers: Hide Your LLM API Key

iOS Audio

Recording a whole class with the screen locked: AVAudioEngine and AVAudioSession in the background

A class runs 45 to 90 minutes with the phone face down in a bag. My recorder's clock kept counting through all of it while the microphone heard nothing. Here is everything that stops a background recording on iOS, and the state machine I ended up writing to survive it.

Continue reading: Recording a whole class with the screen locked: AVAudioEngine and AVAudioSession in the background

About these notes

Written by Artur Berkovics, who builds ClamNotes on his own: the iPhone, iPad and Mac apps, the relay behind them and the website. Each article is one problem from that work, with the wrong turns, the code and the fix.

About ArturRSS feed

What I'm building ClamNotes: record the class, get the notes It records a class, transcribes it on the device and writes a study note in the language that was spoken. For iPhone, iPad and Mac. See ClamNotes