fetchRequest is null when calling second time
问题 The code is let request: NSFetchRequest<NSFetchRequestResult> = Item.fetchRequest() print(request) Item is an entity of Core Data. The first execution is correct, but when execute it again error occurs Thread 12: EXC_BAD_ACCESS (code=1, address=0x0) . The following is logs: This is a similar question, but with Object C. It says that defining managedObjectContext in view controller directly instead of transferring it from AppDelegate can fix the bug. In my code, the managedObjectContext is in