I am struggline with adding data into core data and retrieving. It seems like this code should work but it is throwing an error seen in my title. I'm basically getting data from NSUserDefaults and trying to write that into my core data.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *sellTitle = [defaults objectForKey:@"sellTitle"];
Item *item = (Item *)[NSEntityDescription insertNewObjectForEntityForName:@"Item" inManagedObjectContext:managedObjectContext];
[item setValue:sellTitle forKey:@"title"];
NSError *error;
if (![managedObjectContext save:&error]);
NSLog(@"Failed to add all the data: %@", [error domain]);
+entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name 'Item''
Any idea why? I have tried some of the solutions found in here but nothing is working. For example, i have attempted to implment this into AppDelegate but i'm still getting a nil return on my ManagedObjectContext. Thank you!