CoreData (storing new object) in AppDelegate = SIGABRT <p>I've intented to make a simple function in AppDelegate to store some data in database (CoreData) which would be called from various <code>ViewController</code> classes connected do <code>AppDelegate</code>. This is the body of this function:</p> <pre><code>- (void) setSetting:(NSString *)setting :(NSString *)value { NSManagedObject* newSetting = [NSEntityDescription insertNewObjectForEntityForName:@"EntityName" inManagedObjectContext:self.managedObjectContext]; [newSetting setValue:value forKey:setting]; NSError* error; [self.managedObjectContext save:&amp;error]; } </code></pre> <p>But calling this function (even from AppDelegate itself) returns SIGABRT on line with <code>setValue</code></p> <p>But when I implement the function in <code>ViewController</code> class (replacing <code>self.</code> with proper connection to <code>AppDelegate</code> of course) - it works <strong>fine</strong>.</p> <p>I don't get it and I would really appreciate some help in creating flexible function in <code>AppDelegate</code> to save the data in database.</p>