-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
To get started, first, import the header file MagicalRecord.h in your project's pch file. This will allow a global include of all the required headers.
If you're using CocoaPods or MagicalRecord.framework, your import should look like:
#import <MagicalRecord/MagicalRecord.h>Otherwise, if you've added MagicalRecord's source files directly to your project, your import should be:
#import "MagicalRecord.h"Next, somewhere in your app delegate, in either the - (void)applicationDidFinishLaunching:(UIApplication \*) withOptions:(NSDictionary \*) method, or -(void)awakeFromNib, use one of the following setup calls with the MagicalRecord class:
+ (void) setupCoreDataStack;
+ (void) setupAutoMigratingDefaultCoreDataStack;
+ (void) setupCoreDataStackWithInMemoryStore;
+ (void) setupCoreDataStackWithStoreNamed:(NSString *)storeName;
+ (void) setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(NSString *)storeName;
Each call instantiates one of each piece of the Core Data stack, and provides getter and setter methods for these instances. These well known instances to MagicalRecord, and are recognized as "defaults".
When using the default sqlite data store with the DEBUG flag set, if you change your model without creating a new model version, Magical Record will delete the old store and create a new one automatically. No more uninstall/reinstall every time you make a change!
And finally, before your app exits, you should use the clean up method:
[MagicalRecord cleanUp];MagicalRecord Guide
- Installing MagicalRecord
- Getting Started
- Working with Managed Object Contexts
- Creating Entities
- Deleting Entities
- Fetching Entities
- Saving Entities
- Usage Patterns
- Importing Data
- Logging
Upgrade Guides
Contributing to MagicalRecord
Resources