Ios MagicalRecord-检索上次插入的记录id

Ios MagicalRecord-检索上次插入的记录id,ios,objective-c,magicalrecord,Ios,Objective C,Magicalrecord,我正在使用MagicalRecord,无法理解和检索您刚才保存的记录的id Items *item = [Items MR_createEntity]; item.ref_user = ref_user; [self saveContext]; - (void)saveContext { [[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreWithCompletion:^(BOOL success,

我正在使用MagicalRecord,无法理解和检索您刚才保存的记录的id

Items *item = [Items MR_createEntity];
item.ref_user = ref_user;
[self saveContext];



- (void)saveContext {
    [[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreWithCompletion:^(BOOL success, NSError *error) {
        if (success) {
            DDLogInfo(@"MR_saveContext success");
            [self loadView];
            [self viewDidLoad];
        } else if (error) {
            DDLogError(@"Error saving context: %@", error.description);
        }
    }];
}

为什么不直接创建它呢

item = [ITEM MR_createEntityInContext:defaultContext];
[defaultContext MR_saveToPersistentStoreAndWait];

// you can retrieve the id of above item here

所以问题是什么?