Skip to content

Conversation

@egrim
Copy link

@egrim egrim commented Nov 18, 2020

We found a crash condition on iOS14 when compiled with Xcode 12.1's toolchain (as of November 17, 2020). Trigger conditions are reproducible with this sequence of events:

  1. Create a child context with a parent context tied to the persistent store coordinator
  2. Create objects within the child context and save them to the parent (but not to the persistent store).
  3. Perform a fetch request with a batch limit within the child context
  4. Access one of the results

Starting in iOS14, Core Data will fire a fault request upon accessing one of these results. This request contains a predicate with unsubstituted variables. While the request object contains the variables needed to perform the substitution, I haven't yet found a clean way to access them.

In the course of fixing this bug, I encountered an additional issue that occurs when a predicate includes a collection of unpersisted objects. These objects do not have permanent IDs yet, but EncryptedCoreData code attempts to bind them to the SQL statement, resulting in an error. Existing code handled cases where a predicate includes a single instance of an unpresisted object, but did not handle collections of them. To fix this, I moved the code that successfully handles single objects in parsing expression into the binding method instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant