views:

23

answers:

0

I'm new to objective-c, and I'm trying to make an application that categorizes objects...

I want to make an "all" category but I run into a problem when creating this in my viewDidLoad.

NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity];

if (![[entity valueForKey:@"categoryName"] isEqual:@"Toutes"]){
  NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
  [newManagedObject setValue:@"Toutes" forKey:@"categoryName"];     
}