Building Lanyard, part 6: things to watch out for

The bugs that cost us the most time building an on-device AI app for iPhone, and the rule each one left behind.

Dan Fernández

· 4 min read

Part 6 of Building Lanyard.

Our project notes have a section called “Lessons from testing (don’t relearn these)”. These are the entries that cost us the most time, and what we do differently because of them.

The Simulator is not a phone

Recording failed on every real iPhone. The audio session used .spokenAudio, a mode meant for playback. The Simulator accepted it and UI tests never touch a microphone, so it took the first real iPhone to find it. Anything with a microphone, camera or sensor now gets tried on a device before a build goes out.

The Simulator can’t run everything. The iOS 27 simulator on a macOS 26 Mac has no speech recognition and no on-device model, which is part of why our beta targets iOS 26 while we build with the iOS 27 SDK. We keep a written note of which suites need which machine and check it again with every Xcode release.

Vision returned a sliver. Without the Neural Engine, document detection in the Simulator sometimes returned a thin strip instead of a slide, so we now refuse shapes that can’t be a slide. Treat Simulator ML output as a rough guess and handle the bad cases.

Swift 6 concurrency

Nine thumbnails froze the app. HEIC decoding blocks on a semaphore inside the Simulator’s video decoder. A screen of photo thumbnails filled every thread in Swift’s cooperative pool, and the save for a talk never ran. Blocking image work now goes through its own small queue, and anything that waits on I/O, a semaphore or a system decoder stays off the cooperative pool.

An animation crashed iOS 26. Changing a report’s goal crashed the app. During an animation, SwiftUI built new rows of a LazyVStack on its own render thread, the row code was main-actor code, and Swift 6’s runtime checks trapped. We don’t animate changes that add or move rows in a lazy stack or grid any more.

OS updates

The model’s errors changed names. On iOS 27, Foundation Models throws LanguageModelError instead of GenerationError, and our catch blocks missed refusals until one function mapped both. Catching framework errors in one place means a rename is one fix.

Simulators picked by name ran the wrong OS. Xcode 27 created simulators with the same names as ours on a newer iOS, where speech failed, and every debrief test failed overnight. We pick simulators by name and OS version now.

The build machine

macOS emptied our build folders. One morning every build failed with “There is no Info.plist found”. At 03:35 each night, macOS deletes files older than three days from the user temp folder, and Swift Package Manager unpacks files with their original release dates, so they looked old the day they arrived. Build output doesn’t go in the temp folder any more.

The bundle ID is forever. The first upload to App Store Connect locks it, so choose it on day one and add a “stop and confirm” step before that first upload.

Build numbers jump. Our build number is the commit count, so it’s always unique and always increasing. It also means “build 209” can ship as 211, which is fine as long as everyone knows.

Slow code in “obviously fine” code

One check took 80 minutes. We verify that every quote in a report really appears in the transcript. For a paragraph-long quote in a 31-minute talk, the naive search took more than 80 minutes. One table per starting position brought it to 0.3 seconds, and a full simulated conference day went from over 80 minutes to under 5. Time the pipeline on realistic input and look for the one step that’s quadratic.

The people graph took 19 seconds. At the size of a real conference, matching people across captures took 19 seconds; after a rewrite it takes 0.08. Make the test fixtures as big as real use.

Tests that lie

A test cost 25–40 minutes per run. “Summarize now” was hidden under the capture bar, and on battery the app correctly put off processing the talk, so the test sat waiting for a summary that was never coming. When a test times out, check first whether the app did exactly what it should.

Random data, random failures. A storage test failed whenever a random hash happened to contain “415”. If a fixture is random, the assertion can’t depend on its contents.

Midnight. A run just after midnight gave a business card and slides the same time label. Date logic should be run at midnight and across time zones on purpose.

Fixtures that change on every read. In Swift Testing, a fixture with a generated ID or date written as a computed property makes a new value every time you read it. Make them let constants.

”Can’t read” is not “empty”

The most dangerous pattern we found was a small one. An outbox that couldn’t be read was treated as empty and then saved over, which wiped the queued sends. The same shape turned up with saved decisions, and with a Keychain write, where try? setSecret(try? encode()) deleted a token whenever encoding failed. If a read fails, refuse to write. An error is not an empty list.

The model usually wasn’t the problem

Most of our “AI got it wrong” failures in end-to-end tests weren’t the model. Speech recognition had missed a name or a company, and the model faithfully worked with what it was given. A fresh checkout once said “Couldn’t transcribe this one” for every talk, and nothing was broken: the test transcripts just weren’t in git. Read the transcript before you change the prompt.

Count your bytes

Android showed about 3 MB of traffic with telemetry off, which turned out to be a UI library asking the system to download an emoji font (part 4 has the details). If your app promises not to phone home, measure what it actually sends, from outside the app.


That’s the series for now. Lanyard is in open beta on TestFlight, and your first event is free. If you’re building something similar and hit one of these, or one we haven’t, tell me.

Working on something similar?

If this is close to a problem your team has, tell us about it.