How does this cause deadlock (once in a while) and how do I unravel this
问题 @synchronized (self.class) { fetchedObjects = [moc executeFetchRequest:request error:&error]; } moc is a managedObjectContext It can be the moc that correspond to the main thread. That moc is the parent of all MOC. The other moc are just children. Sometimes when the child do executeFetchRequest it will also make the parent moc do the same executeFetchRequest. What I often see is outside main thread: @synchronized (self.class) { fetchedObjects = [moc executeFetchRequest:request error:&error];