Ed and I discussed the issue behinds the scenes, and so I am chiming in to comment the following error from the Core Data perspective. Regarding the following error:
error: <EXPR>:8:15: error: cannot convert value of type 'NSFetchRequest<ResultType>' to expected argument type 'NSFetchRequest<any NSFetchRequestResult>' context.fetch(request) ^ <EXPR>:8:15: note: arguments to generic parameter 'ResultType' ('ResultType' and 'any NSFetchRequestResult') are expected to be equal
This seems to indicate that you were passing an NSFetchRequest
object tied to one entity as an argument to a closure
(configurationBlock
?) and the closure
expects (or infers) a fetch request tied to the other entity.
Since the potential type mismatch happens in runtime, it's hard to reason the why by simply reading the piece of code. Do you have a minimal sample project that reproduce the issue? You mentioned that the error "does not occur on every call," but since you've figured out the line triggering the crash and use lldb
to trigger the crash report, I'd think that you have a reasonable way to reproduce the issue.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.