Files
yattee/Yattee/AppDelegate.swift
Arkadiusz Fal 8ee5d81a99 Open SwiftData and TipKit stores after didFinishLaunching on iOS
TestFlight crashpoint "_hasTableWithName: + 12" (0xdead10cc) kills the
app ~1s after launch while ModelContainer.init runs WAL recovery from
YatteeApp.init(), before UIApplicationMain. That init also runs during
prewarm launches that iOS can suspend, and the suspended process holds
the store's SQLite lock. In some reports TipKit was opening its own
store from Tips.configure at the same time.

On iOS, DataManager now opens its store lazily, and AppDelegate's
didFinishLaunching configures TipKit and opens the store inside an
OpenDataStore background task. macOS and tvOS keep opening at init.
In-memory stores (tests, previews) open immediately.

Instrumentation: launch logs record prewarm, launch options, whether
the background task was granted, and open duration and trigger. Debug
iOS builds assert before opening if anything touches the store ahead
of didFinishLaunching.

This is a mitigation, not a confirmed fix; watch the crashpoint in the
next build. Moving the store out of the app group is deliberately not
done.
2026-10-31 19:50:30 +01:00

6.3 KiB