Repository navigation
iOS: avoid a SwiftData trap in the stable-id backfill on iOS 27 - #54
Merged
Merged
Conversation
The backfill fetched with `#Predicate { $0.uuid == nil }` inside a function
generic over `StableRecord`. On iOS 27, SwiftData can trap converting that
keypath through the protocol requirement: an App Store crash point shows 1.9
(19) crashing at launch five times in a row on one iPad (iPadOS 27.0.1), and
a Release build crashed the same way once on the iOS 27.0 simulator. It is
not deterministic: later Debug and Release launches of the same code did not
crash. Filter in memory instead, which takes the keypath conversion out of
the launch path entirely.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Code ReviewReviewed the one-line change in One non-blocking note: the crash did not reproduce reliably, so confirm the fix on a TestFlight build with the affected user, as the PR description already says. 🤖 Generated with Claude Code |
roznet
added a commit
that referenced
this pull request
Oct 18, 2026
…gn doc Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A user reported the app crashing immediately at launch on their iPad. The App Store crash point shows 1.9 (19) crashing five times in a row on one iPad Air (iPadOS 27.0.1), 0.2 s after launch, all at the same line:
flyfun_formsApp.backfillStableIDs()→StableRecords.backfill<A>→StableRecords.swift:164, anEXC_BREAKPOINTin SwiftData'sPersistentModel.graph_keyPathToStringwhile converting the predicate.The fetch used
#Predicate { $0.uuid == nil }inside a function generic overStableRecord, so the keypath goes through the protocol requirement rather than a concrete model's stored property.Fix
Fetch each type without a predicate and filter
uuid == nilin memory. Record counts are small, and the behaviour is otherwise unchanged.Testing
🤖 Generated with Claude Code