today im working with a new project created in Xcode 8.1 where i want to use CoreData.
With Xcode 7 there was automatically a NSManagedObjectContext Object in the AppDelegate Class, but in Xcode 8.1 this object is missing.
The NSPersistentStoreCoordinator was changed to NSPersistentContainer.
Now i have no clue how to access the NSManagedObjectContext to write and read values in/from CoreData.
In projects created with Xcode 7 that was the way i've done:
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
NSManagedObjectContext *context = delegate.managedObjectContext;
NSManagedObject *newEntity = [NSEntityDescription insertNewObjectForEntityForName:@"Entity" inManagedObjectContext:context];
Someone has a solution for me?
I found the solution:
Next time i have to read the documentation twice.