Singleton managedObjectContext
问题 I want to use the singleton UIApplication to access the managedObjectContext of the AppDelegate. But when I write [[[UIApplication sharedApplication] delegate] managedObjectContext] or [[[UIApplication sharedApplication] delegate] __managedObjectContext] it doesn't work. But this line works fine : NSLog(@"Seeking for the AppDelegate : %@", [[[UIApplication sharedApplication] delegate] class]); Do you have a solution ? Niels 回答1: Try casting it to your actual app delegate implementation, like