RestKit多个RKObjectManagers对象映射

我使用两个RKObjectManagers,一个没有RKManagedObjectStore(这是共享实例),另一个是。 当我尝试像这样设置RKManagedObjectStore时:

[self.storeBackedObjectManager setObjectStore:[RKManagedObjectStore objectStoreWithStoreFilename:@"conversations.sqlite"]]; 

我得到以下错误:

 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '[RKObjectManager sharedManager].objectStore cannot be nil' 

看起来RestKit试图访问NSManagedObject+ActiveRecord.m中的sharedManager(不使用对象存储)的对象存储:

 + (NSManagedObjectContext*)managedObjectContext { NSAssert([RKObjectManager sharedManager], @"[RKObjectManager sharedManager] cannot be nil"); NSAssert([RKObjectManager sharedManager].objectStore, @"[RKObjectManager sharedManager].objectStore cannot be nil"); return [[[RKObjectManager sharedManager] objectStore] managedObjectContext]; 

}

有没有办法将一个引用传递给我的第二个存储支持的RKObjectManager实例? (如果我暂时将共享pipe理器设置为存储支持的实例,则此映射工作正常)

您正在尝试为托pipe(coredata)和非托pipe模型使用共享的RKObjectManager。 您必须为该RKObjectManager设置objectStore属性。

我想你可以分别使用两个RKObjectManagers,只需使用initWithBaseURL创build它们即可