views:

445

answers:

2

See title ^

Code causing this:

NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];

    Name *name = (Name *)[NSEntityDescription insertNewObjectForEntityForName:@"Name" inManagedObjectContext:context];

    Feature *feature = (Features *)[NSEntityDescription insertNewObjectForEntityForName:@"thing" inManagedObjectContext:context];
    [feature setName:app];  
    [name addFeaturesObject:feature];

app is an NSString defined earlier.

Things I've tried:

in viewDidLoad:

 if (managedObjectContext == nil)
{ 
    managedObjectContext = [(IsidoreAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
}
+1  A: 

Your managed object context is probably not set and the entity "Name" is obviously not valid for a nil context.

In viewDidLoad, you are setting the "managedObjectContext" instance variable for your view controller by using the app delegate which is fine, but then your problem code is using the managed object context from the fetched results controller. Has that been setup yet?

Also, check out this answer to Core Data and UITabBar Controller - help?!

gerry3
it's all there...
Matt S.