Core data 保存托管对象上下文失败RestKit0.20+;核心数据

Core data 保存托管对象上下文失败RestKit0.20+;核心数据,core-data,ios7,restkit-0.20,Core Data,Ios7,Restkit 0.20,我正在迁移连接类以支持通过CoreData进行缓存。RestKit使用RKEntityMapping自动完成此操作。RestKit和CoreData正确地进行了映射和验证,我得到了一堆我请求的NSManagedObject,但它没有将对象保存到CoreData。当我检查日志时,我得到了这个 W restkit.network.core_data:RKManagedObjectRequestOperation.m:776 Saving of managed object context faile

我正在迁移连接类以支持通过CoreData进行缓存。RestKit使用RKEntityMapping自动完成此操作。RestKit和CoreData正确地进行了映射和验证,我得到了一堆我请求的NSManagedObject,但它没有将对象保存到CoreData。当我检查日志时,我得到了这个

W restkit.network.core_data:RKManagedObjectRequestOperation.m:776 Saving of managed object context failed, but a `nil` value for the `error` argument was returned. This typically indicates an invalid implementation of a key-value validation method exists within your model. This violation of the API contract may result in the save operation being mis-interpretted by callers that rely on the availability of the error.
E restkit.network.core_data:RKManagedObjectRequestOperation.m:818 Failed saving managed object context to the persistent store <NSManagedObjectContext: 0x145e5ce0>: (null)

这在我添加所有响应/请求描述符之前调用。我使用MoGenerator生成了模型类。我重写了一些设置程序,并在插入(validateForInsert)之前进行了一些验证。

显示核心数据堆栈配置的代码。你有任何KVC验证吗?我这里没有任何KVO,我只是覆盖了一些setter。KVC和KVO是两个非常不同的东西。堆栈配置如何?我更新了问题。好的,接下来看一下您的
validateForInsert
实现。
- (void)setupCoreData
{
    NSManagedObjectModel *managedObjectModel = [[AppDelegate sharedDelegate] managedObjectModel];
    RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
    [[RKObjectManager sharedManager] setManagedObjectStore:managedObjectStore];

    [managedObjectStore createPersistentStoreCoordinator];

    NSString *storePath = [RKApplicationDataDirectory() stringByAppendingPathComponent:@"Model.sqlite"];

    NSError *error;

    NSPersistentStore *persistentStore = [managedObjectStore addSQLitePersistentStoreAtPath:storePath fromSeedDatabaseAtPath:nil  withConfiguration:nil options:@{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES} error:&error];

    NSAssert(persistentStore, @"Failed to add persistent store with error: %@", error);

    // Create the managed object contexts
    [managedObjectStore createManagedObjectContexts];

    // Configure a managed object cache to ensure we do not create duplicate objects
    managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache alloc] initWithManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext];
}