Hi there
I've set up my project with the "use coredata" option set.
XCode obviously set all this up for me automatically, and now I have these lines in the app delegate header file:
@interface GFree2AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
GFree2ViewController *viewController;
UINavigationController *navController;
NSManagedObjectContext *managedObjectContext_;
NSManagedObjectModel *managedObjectModel_;
NSPersistentStoreCoordinator *persistentStoreCoordinator_;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet GFree2ViewController *viewController;
@property (nonatomic, retain) IBOutlet UINavigationController *navController;
@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;
@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
@property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (NSString *)applicationDocumentsDirectory;
@end
My first question is, why do the initial pointers for the managed object and stuff have underscores? This is how they are used in the .m file and yet the @property
s have no underscores.
My next question is, I want to use the context further in in my script so I've used these lines:
GFree2AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
context = delegate.managedObjectContext;
Now this won't work because obvs there is not @synthesize. But what do I need to synthesize? Do I synthesize WITH the underscore, or without, and do I get it? delegate.managedObjectContext
or delegate.managedObjectContext_
? Or not at all? Ha.. I'm not too sure I understand all this managed object stuff.
Thanks a lot. Tom