KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to have a very simple Core Data. I have a ViewController.h like this : #import <UIKit/UIKit.h> @interface ViewController : UIResponder <UIApplicationDelegate>; @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; - (IBAction)boutonSave:(id)sender; @end and a ViewController.m like that : #import "ViewController.h" @implementation ViewController @synthesize managedObjectContext = __managedObjectContext; @synthesize managedObjectModel = __managedObjectModel; @synthesize persistentStoreCoordinator = __persistentStoreCoordinator; - (IBAction)boutonSave:(id)sender { ViewController *viewController = [[UIApplication sharedApplication] delegate]; NSManagedObjectContext *context = [viewController managedObjectContext]; NSManagedObject *newJournee; //THIS LINE IN ERROR newJournee = [NSEntityDescription insertNewObjectForEntityForName:@"JourneeDeTravail" inManagedObjectContext:context]; [newJournee setValue:_displayStart.text forKey:@"debut"]; [newJournee setValue:_displayEnd.text forKey:@"fin"]; } But when creating newJournee, I have a red alert "Unknow type name 'NSManagedObject', did you mean NSManagedObjectModel ?" ??? It's my first Core Data so I certainly missed something obvious to you... but not to me ! Help !
Tags (comma-separated)
Save Edits
Cancel