I was programming using the Objective-C language and when the Xcode 7
update was done, some errors appeared in the language, one of them is in the file AppDelegate.m
:
(NSManagedObjectContext *)managedObjectContext {
// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.)
if (_managedObjectContext != nil) {
return _managedObjectContext;
}
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
if (!coordinator) {
return nil;
}
_managedObjectContext = [[NSManagedObjectContext alloc] init];
[_managedObjectContext setPersistentStoreCoordinator:coordinator];
return _managedObjectContext;
}
For the highlighted line it displays the following error:
init is deprecated - Use initWithConcurrencyType: instead
How should I write this new structure instead of init
?