Amendments with IOS 9

Asked

Viewed 46 times

0

I was programming using the language Objective-C and when the update of Xcode 7 there were some errors 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 am I supposed to write this new structure in place of the init?

1 answer

0

Just change it that way:

[[NSManagedObjectContext alloc] initWithConcurrencyType:]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.