Thanks for discussed the issue.
I will try to describe this problem in more detail.
The Self is custom class 'Managed', It's a subclass of NSManagedObject.
and I made some changes to delete ‘configurationBlock(request)’.
so the new code:
| public static func fetch(in context: NSManagedObjectContext, |
| configurationBlock: (NSFetchRequest<Self>) -> () = { _ in } ) -> [Self] { |
| let request = NSFetchRequest<Self>(entityName: Self.entityName) |
| return try! context.fetch(request) |
| } |
it become a simplest CoreData query code.
I have called this function dozens of times and the problem with it occurs again and I still use the lldb of Xcode that input 'po context.fetch(request)'.
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
context.fetch(request)
^
I call this method many times in the same way that it successful. I confuse why did it fail.