1. 将 MagicalRecord 文件夹拖入到工程文件中,引入 CoreData.frame 框架

2. 在 .pch 文件中引入头文件 CoreData+MagicalRecord.h4.

3. 创建 Model.xcdatamodeld 文件,并创建一个 Teacher 的 ENTITIES,最后创建出 Teacher 类
在 Appdelete.m 文件中写以下代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:@"mobile.sqlite"];
Teacher * person = [Teacher MR_createEntity];
person.name = @"aaa";
[[NSManagedObjectContext MR_defaultContext]MR_saveToPersistentStoreAndWait];
NSLog(@"anme is %@",person.name);
return YES;
}