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:
Create a child context with a parent context tied to the persistent store coordinator
Create objects within the child context and save them to the parent (but not to the persistent store).
Perform a fetch request with a batch limit within the child context
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.
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:
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.