【iOS】Swift3 报错:Value of type ‘AppDelegate’ has no member ‘managedObjectContext’,UIApplication has no member ‘sharedApplication’

在Swift 3里面,需要通过viewContext访问managedObjectContext,且sharedApplication方法改为shared方法:

以前是这样写的: